Symbol Tables & Storage
GATE CSE & IT · 41 questions across 26 years (1990-2026) · 65% recurrence rate
Recurrence sparkline
1990–2026Difficulty mix
Question types
All 41 questions on Symbol Tables & Storage
Consider the following program in C: #include <stdio.h> void func(int i, int j) { if(i < j) { int i = 0; while (i < 10) { j += 2; i++; } } printf("%d", i); } int main() { int i = 9, j = 10; func(i, j); return 0; } The ou...
In C runtime environment, which one of the following is stored in heap?
Which ONE of the following statements is FALSE regarding the symbol table?
Consider the following C program: #include <stdio.h> void fX(); int main() { fX(); return 0;} void fX() { char a; if ((a = getchar()) != '\n') fX(); if (a != '\n') putchar(a);} Assume that the input to the program from t...
Consider the following program: int main ( ) { f1( ); f2(2); f3( ); return (0); } int f1( ) { return (1); } int f2 (int X) { f3( ); if (X==1) return f1 ( ); else return (X*f2(X$$-$$1)); } int f3( ) { return (5); } Which...
The integer value printed by the ANSI-C program given below is ___________. #include<stdio.h> int funcp(){ static int x = 1; x++ ; return x; } int main(){ int x,y; x = funcp(); y = funcp()+x; printf("%d\n", (x+y)); retur...
Consider the following statements. S 1 : The sequence of procedure calls corresponds to a preorder traversal of the activation tree. S 2 : The sequence of procedure returns corresponds to a postorder traversal of the act...
Consider the following statements. I. Symbol table is accessed only during lexical analysis and syntax analysis. II. Compilers for programming languages that support recursion necessarily need heap storage for memory all...
Consider the following C functions. int fun1 (int n) { static int i = 0; if (n > 0) { ++i; fun1(n-1); } return (i); } ___________________ int fun2 (int n) { static int i = 0; if (n > 0) { i = i + fun1 (n); fun2(n-1); } r...
Consider the following C program : #include<stdio.h> int r() { static int num=7; return num--; } int main() { for(r();r();r()) printf("%od ",r()); return 0; } Which one of the following values will be displayed on execut...
Consider the following C program. #include < stdio.h > void mystery(int *ptra, int *ptrb) { int *temp; temp = ptrb; ptrb = ptra; ptra = temp; } int main() { int a=2016, b=0, c=4, d=42; mystery(&a, &b); if (a < c) mystery...
Which of the following statements are CORRECT? 1) Static allocation of all data areas by a compiler makes it impossible to implement recursion. 2) Automatic garbage collection is essential to implement recursion. 3) Dyna...
Consider the C function given below. int f(int j) { static int i = 50; int k; if (i == j) { printf("something"); k = f(i); return 0; } else return 0; } Which one of the following is TRUE ?
What is the return value of f (p, p), if the value of p is initialized to 5 before the call? Note that the first parameter is passed by reference, whereas the second parameter is passed by value. int f (int &x, int c) {...
Consider the program given below, in a block-structured pseudo-language with lexical scoping and nesting of procedures permitted. Program main; Var . . . Procedure A1; Var . . . Call A2; End A1 Procedure A2; Var . . . Pr...
Consider the following C code segment. int a, b, c = 0; void prtFun(void); main( ) { static int a = 1; /* Line 1 */ prtFun(); a + = 1; prtFun(); printf("\n %d %d ", a, b); } void prtFun(void) { static int a=2; /* Line 2...
Consider the following C code segment. int a, b, c = 0; void prtFun(void); main( ) { static int a = 1; /* Line 1 */ prtFun(); a + = 1; prtFun(); printf("\n %d %d ", a, b); } void prtFun(void) { static int a=2; /* Line 2...
Which languages necessarily need heap allocation in the runtime environment?
Which data structure in a compiler is used for managing information about variables and their attributes?
Which of the following are true? I. A programming language which does not permit global variables of any kind and has no nesting of procedures/functions, but permits recursion can be implemented with static storage alloc...
Which of the following are true? I. A programming language which does not permit global variables of any kind and has no nesting of procedures/functions, but permits recursion can be implemented with static storage alloc...
Consider the following C function: int f(int n) { static int r = 0; if(n <= 0) return 1; if(n>3) { r = n; return f(n-2)+2; } return f(n-1)+r; } What is the value of f(5)?
Consider the following C program: void foo (int n, int sum) { int k = 0, j = 0; if(n==0) return; k=n%10; j = n /10; sum = sum + k; foo(j, sum); printf("%d",k); } int main () { int a = 2048, sum = 0; foo(a, sum); printf("...
Consider the following C function: int f(int n) { static int i = 1; if(n>=5) return n; n = n+1; i++; return f(n); } The value returned by f(1) is
The following program fragment is written in a programming language that allows global variables and does not allow nested declarations of functions. global int i = 100, j = 5; void P(x) { int i = 10; print(x + 10); i =...
Consider the C program shown below. #include < stdio.h > #define print(x) printf("%d ", x) int x; void Q(int z) { z += x; print(z); } void P(int *y) { int x = *y+2; Q(x); *y = x-1; print(x); } main(void) { x = 5; P(&x);...
The following program fragment is written in a programming language that allows global variables and does not allow nested declarations of functions. global int i = 100, j = 5; void P(x) { int i = 10; print(x + 10); i =...
Consider the following program Program P2 var n:int; procedure W(var x:int) begin x=x+1; print x; end procedure D begin var n:int; n=3; W(n); end begin \\begin P2 n = 10; D; end If the language has dynamic scooping and p...
Consider the following three C functions: [P1] int*g(void) { int x=10; return(&x); } [P2] int*g(void) { int *px; *px = 10; return px; } [P3] int*g(void) { int *px px =(int*)malloc (size of (int)); *px = 10; return px; }...
The value of j at the end of the execution of the following C program int incr (int i) { static int count = 0; count = count + i; return (count); } main () { int i,j; for (i = 0; i <= 4; i++) j = incr(i); } is
Consider the following program in a language that has dynamic scooping: var x: real; procedure show; begin print(x); end; procedure small; var x: real; begin x: = 0.125; show; end; begin x:=0.25; show; small end; Then th...
Faster access to non-local variables is achieved using an array of pointers to activation records called a
Given the following Pascal like program segment: Procedure A; x,y:intger; Procedure B; x,z:real; S1 end B; Procedure C; i:integer; S2; end C; end A; The variables accessible in S1 and S2 are
Heap allocation is required for languages.
The pass numbers for each of the following activities (i) object code generation (ii) literals added to literal table (iii) listing printed (iv) address resolution of local symbols that occur in a two pass assembler resp...
The correct matching for the following pairs is List - I (A) Activation record (B) Location counter (C) Reference counts (D) Address relocation List - II (1) Linking loader (2) Garbage collection (3) Subroutine call (4)...
A linker is given object modules for a set of programs that were compiled separately. What information need to be included in an object module?
What is the value of X printed by the following program? program COMPUTE (input, output); var X:integer; procedure FIND (X:real); begin X:=sqrt(X); end; begin X:=2 Find(X) Writeln(X) end
Indicate the following statement true or false : A programming language not supporting either recursion or pointer type does not need the support of dynamic memory allocation.
Match the followings: Group-I (a) Pointer data type (b) Activation Record (c) Repeat -Until (d) Coercion Group-II (p) Type Conversion (q) Dynamic Data Structure (r) Recursion (s) Nondeterministic loop
Match the pairs in the following: List - I (A) Pointer data type (B) Activation record (C) Repeat-until (D) Coercion List - II (p) Type conversion (q) Dynamic data structure (r) Recursion (s) Nondeterministic loop