PART III : Language processing, interpretation, translation, the concept of binding, variables, name and scope, Type, l-value, r-value, reference and unnamed variables, routines, generic routines, aliasing and overloading, an abstractsemanticprocessor, run time structure. Casestudy- C run time structure ((MARKS (/2/3... N A B C _CHOICE (A/B/C/ TION Aliasing in the context of programming languages refers to multiple variables having the same memory location multiple variables having the same value multiple variables having the same identifier multiple uses of the same variable A Aliasing describes a situation in which a data location in memory can be accessed through different symbolic names in the program. ((MARKS (/2/3... N A In the evaluation of a computer language, all of the following characteristics should be considered except? Environment : S/w development tools
B C _CHOICE (A/B/C/ TION Efficiency readability hardware maintainance costs No Explanation ((MARKS (/2/3... N A B C _CHOICE (A/B/C/ TION 2 What is printed by the print statements in the program P assuming call by reference parameter passing? 0, 3 3, 3 27, 7 None of the above B Note the order in which parameters are passed. Inside func(, x will actually refer to y of main(; and y and z will
refer to x of main(. The Statement y = y + 4; will result in 4 and statement z = x + y + z will make z = 3 + 4 + 4 = 3 (because y and z point to same variable x of main. Since z refers to x of main(, main will print 3. ((MARKS (/2/3... N 2 Consider the following program Program P2 var n: int: procedure W(var x: int begin x=x+; print x; end procedure begin var n: int; n=3; W(n; end begin //beginp2 n=0; ; end If the language has dynamic scoping and parameters are passed by reference, what will be printed by the program? A 0
B C _CHOICE (A/B/C/ TION 3 None of Above Program will print 4. ((MARKS (/2/3... N A ((OTION_B C _CHOICE (A/B/C/ TION The- results returned by functions under value-result and reference parameter passing conventions o not differ iffer in the presence of loops iffer in all cases May differ in the presence of exceptions In call-by-reference evaluation, a function receives an implicit reference to the argument, rather than a copy of its value. This typically means that the function can modify
the argument- something that will be seen by its caller. Note that C doesn t support call by reference but call-byreference can be implemented using pointers. Call-by-value-result uses a combination of call-by-value and call-by-reference. Call-by-value-result works by creating local versions of the parameters passed in. However, the values in these local versions are copied back to the original arguments after the end of the procedure. ((MARKS (/2/3... N Values that are passed between program and its called subroutine are classified as A ((OTION_B C _CHOICE (A/B/C/ parameter. argument. global values. both a and b. TION
((MARKS (/2/3... N A B C _CHOICE (A/B/C/ TION Program subroutines are called by other programs. fixed variable. default constants. default variables. A No Explanation ((MARKS (/2/3... N Program routine which is used by one or more computer programs is classified as A B super-routine. subroutine. dimension routine.
C _CHOICE (A/B/C/ TION array routine. B ((MARKS (/2/3... N A B C _CHOICE (A/B/C/ TION Program used for interactive computing is Translator Executor Instructor Interpreter
((MARKS (/2/3... N A B C _CHOICE (A/B/C/ TION Program which translates high level program into machine code is classified as Compiler. Translator. Translating Analyst instruction analst A ((MARKS (/2/3... N A B C ynamic binding takes place during Translation Linking Loading the program
_CHOICE (A/B/C/ TION Execution ((MARKS (/2/3... N A B C _CHOICE (A/B/C/ TION Static binding takes placed during Translation Linking Loading the program All of the Above
((MARKS (/2/3... N A B C _CHOICE (A/B/C/ TION In which of the following mechanisms, types of all variables and expressions are fixed at compilation time. Strong Typing Weak Typing Static Binding/ early binding ynamic Binding/ late binding C ((MARKS (/2/3... N A B C In which of the following mechanisms, types of all variables and expressions are not known until runtime Strong Typing Weak Typing Static Binding/ early binding
_CHOICE (A/B/C/ TION ynamic Binding/ late binding ((MARKS (/2/3... N A B C _CHOICE (A/B/C/ TION In which of the following mechanisms, types of all variables and expressions are not known until runtime Strong Typing Weak Typing Static Binding/ early binding ynamic Binding/ late binding
((MARKS (/2/3... N A B C _CHOICE (A/B/C/ TION What is the scope of an external variable? Whole source file in which it is defined From the point of declaration to the end of the file in which it is defined Any source file in a program From the point of declaration to the end of the file being compiled ((MARKS (/2/3... N A B What is the scope of a function? Whole source file in which it is defined From the point of declaration to the end of the file in which
it is defined C _CHOICE (A/B/C/ TION Any source file in a program From the point of declaration to the end of the file being compiled ((MARKS (/2/3... N A B C Which variable has the longest scope? a b c #include <stdio.h> int b; int main( { int c; return 0; } int a; Both a and b
_CHOICE (A/B/C/ TION B ((MARKS (/2/3... N Scope of variable is related to definition of variable as:. Region of code within which variable value is valid and hence can be accessed. 2. No, relation with region where variable is declared its value is valid in entire scope. A B C _CHOICE (A/B/C/ TION 2 Both and 2 None A
((MARKS (/2/3... N Scope of variable is related to definition of variable as:. Region of code within which variable value is valid and hence can be accessed. 2. No, relation with region where variable is declared its value is valid in entire scope. A B C _CHOICE (A/B/C/ TION 2 Both and 2 None A ((MARKS (/2/3... N A variable that receives an assigned value is called an...
A B C _CHOICE (A/B/C/ TION L-value R-value Value Assignment A ((MARKS (/2/3... N A B C _CHOICE (A/B/C/ Recursion is sometimes called... Circular definition Complex definition Procedure Union A
TION ((MARKS (/2/3... N A B C _CHOICE (A/B/C/ TION 2 What will be the output of the following program? #include<stdio.h> int main( { int i = 0; printf("%d", ++(-i; return 0; } 0-9 None In C/C++ the pre-increment (decrement and the postincrement (decrement operators require an L-value expression as operand. Providing an R-value or a const qualified variable results in compilation error.
((MARKS (/2/3... N A B C _CHOICE (A/B/C/ TION 2 What will be output if you will compile and execute the following c code? #define max 5; void main({ int i=0; i=max++; printf("%d",i++; } 5 6 R-value required L-value Required It is clear macro constant max has replaced by 5. It is illegal to increment the constant number. Hence compiler will show Lvalue required. ((MARKS (/2/3... N Variable which uses same name in whole program and in its all routines thus best classified as Middle variable
A B C _CHOICE (A/B/C/ TION Global Variable Local Variable efault Varaible B No Explanation ((MARKS (/2/3... N A B C _CHOICE (A/B/C/ Use of recursion enhances logical clarity makes debugging easier reduces execution time reduces code size
TION No Explanation ((MARKS (/2/3... N A B C _CHOICE (A/B/C/ TION In which of the following parameter passing mechanism, the actual argument has to be a variable? Pass by value Pass by result Pass by value-result Pass by reference B No Explanation ((MARKS (/2/3... N The generic type in a template function
A B C _CHOICE (A/B/C/ TION must be T Can be T cannot be T for functions you create, but may be for C++'s built-in functions B Cannot be T ((MARKS (/2/3... N A B C _CHOICE (A/B/C/
TION