Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I want to solve questions Question#1: Answer question either with True or False (10 points) 1. ( ) If (condition) statment1 else if (condition) statment2
I want to solve questions
Question\#1: Answer question either with True or False (10 points) 1. ( ) If (condition) statment1 else if (condition) statment2 else statment3 is a n-way selection statement. 2. ( ) For static variables, the storage bindings are created for variables when their declaration statements are elaborated. 3. ( ) Poor reliability leads to high costs is the software fails in the critical systems. 4. ( ) In compilation process, the optimization process for the code to make it faster is done in syntax analyzer phase. 5. ( ) Associative arrays in COBOL are called dictionaries. 6. ( ) Operator associativity rules is executed from left to right or from right to left in Java programming language. 7. ( ) Is allowed to define variable strings with varying length and no maximum length in python programming language. ) The static variable is bound to a value only when it is bound to storage and this value unchangeable. In BNF, the start symbol is a special element of the nonterminals of a grammar. ) Operational Semantics is having two or more distinct names in a program that can be used to access the same memory cell. Questionit2: Fill in the box with the number of the most appropriate choice from the left. (6 points) a. Circle "valid" for each string that is in the language generated by this grammar. If it is not valid, circle "not valid". Please specify. (i) baab validot valid (ii) bbbab validot valid (iii) bbaaaa validot valid (iv) bbaab validot valid b. Is the previous grammar ambiguous? Why? Question4: Compute the weakest precondition for the following sequences of assignment statements and their post-conditions: (3points) a=3(2b+a)b=2a1{b>5} QuestionH 5: Consider the following program, written in JavaScript-like syntax: (5 points) Given the following calling sequences and assuming that dynamic scoping is used, what variables are visible during execution of the last subprogram activated? Include with each visible variable the name of the unit where it is declared. a) main calls sub1; sub1 calls sub2; sub2 calls sub3. b) main calls sub3; sub3 calls sub1; Question\#6: Rewrite the following code segment using a multiple-selection statement using Java, or C\# languages. (5 points) If ((k==1)(k==2))j=2k1 if ((k==3)(k==5))j=3k+1 if (k==4)j=4k1 if ((k==6)(k==7)(k==8))j=k2 Question\#7: Answer the following questions. (15 points) a) How is referential transparency related to functional side effects? ( 3 points ) b) Describe the lazy (or Mark-sweep) and eager (or Reference counters) approaches to reclaiming garbage? Using some examples to explain your descriptions? ( 3 points) c) What is short-circuit evaluation? Using some examples to explain your descriptions? Name a language that always does short-circuit evaluation of Boolean expressions. Name one that never does it. ( 3 points) d) Describe narrowing and widening conversions. Give an example to show the differences between the two conversions? ( 3 points) e) What is orthogonality in the context of programming language design? Give an example from a real programming language. How does orthogonality relate to the design principle of reliability? ( 3 points) Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started