SlideShare a Scribd company logo
1 of 1
Download to read offline
Problem 3 [12pt] Consider the following pseudo-code with higher-order function support. Assume
that the language has one scope for each function, and it allows nested functions (hence, nested
scopes). In the pseudo code, declarations with type int are local declarations; otherwise the
variables not declared locally are referring to the outer level of function. function A(){ int x=5;
function C(P){ int x=3; P(); function D(); print x; function B(); int x=4; C (D); ; } B(); f() a) (3pt) What
would the program print if this language uses dynamic scoping and shallow binding (binding
happens when the function is called)? b) (6pt) Justify your answer by showing the tree of symbol
tables when execution reaches the display expression. c) (3pt) What would the program print if
this language uses static/lexical scoping?

More Related Content

Similar to Problem 3 12pt Consider the following pseudocode with hig.pdf

Fundamentals of programming and problem solving
Fundamentals of programming and problem solvingFundamentals of programming and problem solving
Fundamentals of programming and problem solving
Justine Dela Serna
 
COMP 2103X1 Assignment 2Due Thursday, January 26 by 700 PM.docx
COMP 2103X1 Assignment 2Due Thursday, January 26 by 700 PM.docxCOMP 2103X1 Assignment 2Due Thursday, January 26 by 700 PM.docx
COMP 2103X1 Assignment 2Due Thursday, January 26 by 700 PM.docx
donnajames55
 

Similar to Problem 3 12pt Consider the following pseudocode with hig.pdf (20)

Fundamentals of programming and problem solving
Fundamentals of programming and problem solvingFundamentals of programming and problem solving
Fundamentals of programming and problem solving
 
Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make
 
What is turbo c and how it works
What is turbo c and how it worksWhat is turbo c and how it works
What is turbo c and how it works
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answers
 
LISP: назад в будущее, Микола Мозговий
LISP: назад в будущее, Микола МозговийLISP: назад в будущее, Микола Мозговий
LISP: назад в будущее, Микола Мозговий
 
Introduction to F#
Introduction to F#Introduction to F#
Introduction to F#
 
Unit 1 c - all topics
Unit 1   c - all topicsUnit 1   c - all topics
Unit 1 c - all topics
 
C programming basics
C  programming basicsC  programming basics
C programming basics
 
C basics
C   basicsC   basics
C basics
 
C programming language Reference Note
C programming language Reference NoteC programming language Reference Note
C programming language Reference Note
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answers
 
COMP 2103X1 Assignment 2Due Thursday, January 26 by 700 PM.docx
COMP 2103X1 Assignment 2Due Thursday, January 26 by 700 PM.docxCOMP 2103X1 Assignment 2Due Thursday, January 26 by 700 PM.docx
COMP 2103X1 Assignment 2Due Thursday, January 26 by 700 PM.docx
 
Python | What is Python | History of Python | Python Tutorial
Python | What is Python | History of Python | Python TutorialPython | What is Python | History of Python | Python Tutorial
Python | What is Python | History of Python | Python Tutorial
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c language
 
Compiler chapter six .ppt course material
Compiler chapter six .ppt course materialCompiler chapter six .ppt course material
Compiler chapter six .ppt course material
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer
 
1. introduction to computer
1. introduction to computer1. introduction to computer
1. introduction to computer
 
Std 10 computer chapter 10 introduction to c language (part1)
Std 10 computer chapter 10 introduction to c language (part1)Std 10 computer chapter 10 introduction to c language (part1)
Std 10 computer chapter 10 introduction to c language (part1)
 
A Crash Course in C Part-1
A Crash Course in C Part-1A Crash Course in C Part-1
A Crash Course in C Part-1
 

More from aadeshwarexports

Problem Solvinf Activity Fer each response 17 State whethe.pdf
Problem Solvinf Activity Fer each response 17 State whethe.pdfProblem Solvinf Activity Fer each response 17 State whethe.pdf
Problem Solvinf Activity Fer each response 17 State whethe.pdf
aadeshwarexports
 
Problem How do you copy a file Analyze the problem and con.pdf
Problem How do you copy a file Analyze the problem and con.pdfProblem How do you copy a file Analyze the problem and con.pdf
Problem How do you copy a file Analyze the problem and con.pdf
aadeshwarexports
 
Problem 8T2 The code below attached to the Lab 7 is tem.pdf
Problem 8T2 The code below attached to the Lab 7 is tem.pdfProblem 8T2 The code below attached to the Lab 7 is tem.pdf
Problem 8T2 The code below attached to the Lab 7 is tem.pdf
aadeshwarexports
 

More from aadeshwarexports (20)

Problem Solvinf Activity Fer each response 17 State whethe.pdf
Problem Solvinf Activity Fer each response 17 State whethe.pdfProblem Solvinf Activity Fer each response 17 State whethe.pdf
Problem Solvinf Activity Fer each response 17 State whethe.pdf
 
Problem How do you copy a file Analyze the problem and con.pdf
Problem How do you copy a file Analyze the problem and con.pdfProblem How do you copy a file Analyze the problem and con.pdf
Problem How do you copy a file Analyze the problem and con.pdf
 
Problem Random variable XY is Gaussian with mean Y varianc.pdf
Problem Random variable XY is Gaussian with mean Y varianc.pdfProblem Random variable XY is Gaussian with mean Y varianc.pdf
Problem Random variable XY is Gaussian with mean Y varianc.pdf
 
Problem A pair of dice is thrown are the random variable z .pdf
Problem A pair of dice is thrown are the random variable z .pdfProblem A pair of dice is thrown are the random variable z .pdf
Problem A pair of dice is thrown are the random variable z .pdf
 
Problem AIFS is thinking about hedging risk of hotel book.pdf
Problem AIFS is thinking about hedging risk of hotel book.pdfProblem AIFS is thinking about hedging risk of hotel book.pdf
Problem AIFS is thinking about hedging risk of hotel book.pdf
 
Problem B Cont of the Problem A Now after you learned and .pdf
Problem B Cont of the Problem A Now after you learned and .pdfProblem B Cont of the Problem A Now after you learned and .pdf
Problem B Cont of the Problem A Now after you learned and .pdf
 
Problem 9 Calculating N i5.pdf
Problem 9 Calculating N i5.pdfProblem 9 Calculating N i5.pdf
Problem 9 Calculating N i5.pdf
 
Problem 8T2 The code below attached to the Lab 7 is tem.pdf
Problem 8T2 The code below attached to the Lab 7 is tem.pdfProblem 8T2 The code below attached to the Lab 7 is tem.pdf
Problem 8T2 The code below attached to the Lab 7 is tem.pdf
 
Problem 723 Stock Valuation LO 1 Youve collected the fol.pdf
Problem 723 Stock Valuation LO 1 Youve collected the fol.pdfProblem 723 Stock Valuation LO 1 Youve collected the fol.pdf
Problem 723 Stock Valuation LO 1 Youve collected the fol.pdf
 
Problem 62 The historical annual returns of stocks X and Y.pdf
Problem 62 The historical annual returns of stocks X and Y.pdfProblem 62 The historical annual returns of stocks X and Y.pdf
Problem 62 The historical annual returns of stocks X and Y.pdf
 
Problem 6 20 Points Sketch the output waveforms Q1Q2Q3.pdf
Problem 6 20 Points Sketch the output waveforms Q1Q2Q3.pdfProblem 6 20 Points Sketch the output waveforms Q1Q2Q3.pdf
Problem 6 20 Points Sketch the output waveforms Q1Q2Q3.pdf
 
Problem 53 The historical annual returns of a stock are Y.pdf
Problem 53 The historical annual returns of a stock are Y.pdfProblem 53 The historical annual returns of a stock are Y.pdf
Problem 53 The historical annual returns of a stock are Y.pdf
 
Problem 4 Two continuous random variables X and Y have a jo.pdf
Problem 4 Two continuous random variables X and Y have a jo.pdfProblem 4 Two continuous random variables X and Y have a jo.pdf
Problem 4 Two continuous random variables X and Y have a jo.pdf
 
PROBLEM 4 Honoring Buzz Function Name fancyBuzz Paramet.pdf
PROBLEM 4 Honoring Buzz Function Name fancyBuzz Paramet.pdfPROBLEM 4 Honoring Buzz Function Name fancyBuzz Paramet.pdf
PROBLEM 4 Honoring Buzz Function Name fancyBuzz Paramet.pdf
 
Problem 4 Closing Entries 22 points Following is an alph.pdf
Problem 4 Closing Entries  22 points Following is an alph.pdfProblem 4 Closing Entries  22 points Following is an alph.pdf
Problem 4 Closing Entries 22 points Following is an alph.pdf
 
Problem 4Lexical Semantics The WordNet entry for the nouns .pdf
Problem 4Lexical Semantics The WordNet entry for the nouns .pdfProblem 4Lexical Semantics The WordNet entry for the nouns .pdf
Problem 4Lexical Semantics The WordNet entry for the nouns .pdf
 
Problem 5 4 pts each part Let A be the language accepted.pdf
Problem 5  4 pts each part Let A be the language accepted.pdfProblem 5  4 pts each part Let A be the language accepted.pdf
Problem 5 4 pts each part Let A be the language accepted.pdf
 
Problem 4 IP Routing Table Design 20 pts Consider an IP n.pdf
Problem 4 IP Routing Table Design 20 pts Consider an IP n.pdfProblem 4 IP Routing Table Design 20 pts Consider an IP n.pdf
Problem 4 IP Routing Table Design 20 pts Consider an IP n.pdf
 
Problem 4 Buffons needle problem 20 points graded on ac.pdf
Problem 4 Buffons needle problem 20 points graded on ac.pdfProblem 4 Buffons needle problem 20 points graded on ac.pdf
Problem 4 Buffons needle problem 20 points graded on ac.pdf
 
Problem 4 Budgeting Time for Chilling Consider the followin.pdf
Problem 4 Budgeting Time for Chilling Consider the followin.pdfProblem 4 Budgeting Time for Chilling Consider the followin.pdf
Problem 4 Budgeting Time for Chilling Consider the followin.pdf
 

Recently uploaded

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 

Problem 3 12pt Consider the following pseudocode with hig.pdf

  • 1. Problem 3 [12pt] Consider the following pseudo-code with higher-order function support. Assume that the language has one scope for each function, and it allows nested functions (hence, nested scopes). In the pseudo code, declarations with type int are local declarations; otherwise the variables not declared locally are referring to the outer level of function. function A(){ int x=5; function C(P){ int x=3; P(); function D(); print x; function B(); int x=4; C (D); ; } B(); f() a) (3pt) What would the program print if this language uses dynamic scoping and shallow binding (binding happens when the function is called)? b) (6pt) Justify your answer by showing the tree of symbol tables when execution reaches the display expression. c) (3pt) What would the program print if this language uses static/lexical scoping?