Code Generation
GATE CSE & IT · 14 questions across 12 years (1989-2024) · 30% recurrence rate
Recurrence sparkline
1989–2024Difficulty mix
Question types
All 14 questions on Code Generation
Consider the following C program. Assume parameters to a function are evaluated from right to left. #include <studio.h> int g(int p) { printf("%d", p); return p; } int h(int q) { printf("%d", q); return q; } void f(int x...
Consider the following statements regarding the front-end and back-end of a compiler. S1: The front-end includes phases that are independent of the target hardware. S2: The back-end includes phases that are specific to t...
The output of the following C program is__________. void f1(int a, int b) { int c; c=a; a=b; b=c; } void f2(int *a, int *b) { int c; c=*a; *a=*b; *b=c; } int main(){ int a=4, b=5, c=6; f1(a,b); f2(&b, &c); printf(“%d”,c-...
What does the following program print? #include < stdio.h > void f (int *p, int *q) { p = q; *p = 2; } int i = 0, j = 1; int main ( ){ f(&i, &j); printf ("%d %d \ n", i, j); return 0; }
Consider the following C function: void swap (int a, int b) { int temp; temp = a; a = b; b = temp; } In order to exchange the values of two variables x and y.
Consider the grammar rule $$E \to {E_1} - {E_2}$$ for arithmetic expressions. The code generated is targeted to a CPU having a single user register. The subtraction operation requires the first operand to be in the regis...
Which of the following is NOT an advantage of using shared, dynamically linked libraries as opposed to using statically linked libraries?
The results returned by function under value-result and reference parameter passing conventions
What is printed by the print statements in the program P1 assuming call by reference parameter passing? Program P1() { x=10; y=3; func1(y,x,x); print x; print y; } func1(x,y,z) { y=y+4; z=x+y+z; }
The process of assigning load addresses to the various parts of the program and adjusting the code and date in the program to reflect the assigned addresses is called
What is the result of the following program? program side-effect (input, output); var x, result: integer: fucntion f (var x:integer):integer; begin x:x+1;f:=x; end begin x:=5 result:=f(x)*f(x) writeln(result) end
In which one of the following cases is it possible to obtain different results for call-by-reference and call-by-name parameter passing methods?
Indicate the following statement true or false: Although C does not support call by name parameter passing, the effect can be correctly simulated in C.
In which of the following cases it is possible to obtain different results for call-by-reference and call-by-name parameter passing?