GATE CSE
Programming Languages
Basic of Programming Language
Previous Years Questions

## Marks 1

What is printed by the following ANSI C program? #include <stdio.h> int main(int argc, char *argv[]) { char a = 'P'; char b = 'x'; ...
Consider the following ANSI C program: int main() { Integer x; return 0; } Which one of the following phases in a seven-phase C compiler will thr...
Consider the following C function. int fun ( int n ) {    int x = 1, k ;    if ( n == 1) return x ;    for( k = 1 ;...
Consider the function func shown below: int func(int num) {          int count = 0;    &...
Suppose n and p are unsigned int variables in a C program. We wish to set p to $${}^n{C_3}$$. If n is large, which one of the following statements is ...
Which one of the following is NOT performed during compilation?
Which of the following statements are CORRECT? 1) Static allocation of all data areas by a compiler makes it impossible to implement recursion. 2) Aut...
Let A be a square matrix size $$n \times n$$. Consider the following pseudocode. What is the expected output? C = 100; for i = 0 to n do for j = 1 t...
Consider the following program in C language: #include < stdio.h > main() { int i; int *pi = &i; scanf("%d", pi); printf("%d\n", i + 5); } W...
Which languages necessarily need heap allocation in the runtime environment?
A common property of logic programming languages and functional languages is:
The goal of structured programming is to
Choose the best matching between the programming style in Group 1 and their characteristics in Group 2 Group 1 P. Functional Q. Logic R. Object-orient...
Which of the following statements is FALSE?
The results returned by function under value-result and reference parameter passing conventions
Heap allocation is required for languages.
What are x and y in the following macro definition? macro Add x,y Load y Mul x Store y end macro
An unrestricted use of the "goto" statement is harmful because
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...
Indicate the following statement true or false: A programming language not supporting either recursion or pointer type does not need the support of dy...

## Marks 2

Consider the following pseudo code, where x and y are positive integers. begin q := 0 r := x while r ≥ y do begin r := r -...
Consider the C function given below. int f(int j) { static int i = 50; int k; if (i == j) { printf("something"); k = f...
Consider the following function double f (double x) { if ( abs (x * x – 3) < 0. 01) return x; else return f (x / 2 + 1.5/x); } Give a value...
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, whe...
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/functio...
The following program fragment is written in a programming language that allows global variables and does not allow nested declarations of functions. ...
The following program fragment is written in a programming language that allows global variables and does not allow nested declarations of functions. ...
What is printed by the print statements in the program P1 assuming call by reference parameter passing? Program P1() { x=10; y=3; func1...
Consider the following program Program P2 var n:int; procedure W(var x:int) begin x=x+1; print x; end ...
Given the programming constructs: (i) assignment (ii) for loops where the loop parameter cannot be changed within the loop (iii) if-then-else (iv) for...
Consider the following program in a language that has dynamic scooping: var x: real; procedure show; begin print(x); end; procedure small; ...
A certain processor supports only the immediate and the direct addressing modes. Which of the following programming language features cannot be implem...
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; &n...
The correct matching for the following pairs is List - I (A) Activation record (B) Location counter (C) Reference counts (D) Address relocation List ...
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?
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)...
Match the pairs in the following: List - I (A) Small talk (B) LISP (C) Prolog (D) VAL List - II (p) Logic programming (q) Data flow programming (r) Fu...
In which of the following cases it is possible to obtain different results for call-by-reference and call-by-name parameter passing?
An unrestricted use of the "goto" statement is harmful because of which of the following reason(s):
EXAM MAP
Joint Entrance Examination