• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 20 pages
Exam (elaborations)

CS 326 Study guide

Document preview thumbnail
Preview 3 out of 20 pages

CS 326 Study guide - answersA = B * C + (A * C) assign → id = expr id → A | B | C expr → id + expr | id * expr | ( expr) | id - answersAssuming dynamic scoping, what is the value of y in function sub2 for both calling sequences? function big() { function sub1() { var x = 7; sub2(); } function sub2() { var y = x; var z = 3; } var x = 3; sub2(); } - answersCreate a Parse Tree with the following input

Content preview

CS 326 Study guide
- answers✔✔A = B * C + (A * C)




<assign> → <id> = <expr>

<id> → A | B | C

<expr> → <id> + <expr>

| <id> * <expr>

| ( <expr>)

| <id>



- answers✔✔Assuming dynamic scoping, what is the value of y in function sub2 for both calling
sequences?

function big() {

function sub1() {

var x = 7;

sub2();

}

function sub2() {

var y = x;

var z = 3;

}

var x = 3;

sub2();

}



- answers✔✔Create a Parse Tree with the following input

,A ** B



<factor> → <expr> ** <factor>

| <expr>

<expr> → ( <factor> )

| <id>

<id> → A | B | C



- answers✔✔Develop a derivation and a Parse tree for the string

A=B+C*A



<assign> → <id> = <expr>

<id> → A | B | C

<expr> → <expr> + <term>

| <term>

<term> → <term> * <factor>

| <factor>

<factor> → ( <expr>)

| <id>



- answers✔✔Draw parse tree

A=B*(A+C)



<assign> → <id> = <expr>

<id> → A | B | C

<expr> → <id> + <expr>

| <id> * <expr>

| ( <expr>)

| <id>

, - answers✔✔Identify the Challenges in this Pass-by-Reference function in C++

void fun(int &first, int &second) {

first = 17;

second = 35;

}

//other stuff here

int total = 5;

fun(total, total);



- answers✔✔Identify the Challenges in this Pass-by-Result function in C#.

void Fixer( out int x, out int y) {

x = 17;

y = 35;

}

//other stuff here

f.Fixer(out a, out a);



- answers✔✔Identify the parts of the function with a partner.

Functions:

sumer(length = my_length, list = my_array, sum = my_sum)

def compute_pay(income, exemptions = 1, tax_rate)

float compute_pay(float income, float tax_rate, int exemptions = 1)

Note: These are from different programming languages.



- answers✔✔Look at slides 6/7 in syntax part 2



(e.g., HTML, CSS) - answers✔✔Markup

Document information

Uploaded on
August 10, 2025
Number of pages
20
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$8.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
196
Last sold
-




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions