1
GATE CSE 2023
MCQ (Single Correct Answer)
+2
-0.67

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 one of the following options represents the activation tree corresponding to the main function?

A
GATE CSE 2023 Programming Languages - Basic of Programming Language Question 3 English Option 1
B
GATE CSE 2023 Programming Languages - Basic of Programming Language Question 3 English Option 2
C
GATE CSE 2023 Programming Languages - Basic of Programming Language Question 3 English Option 3
D
GATE CSE 2023 Programming Languages - Basic of Programming Language Question 3 English Option 4
2
GATE CSE 2022
MCQ (Single Correct Answer)
+2
-0.67

What is printed by the following ANSI C program?


 #include <stdio.h>
 int main(int argc, char *argv[]) {
    char a = 'P';
    char b = 'x';
    char c = (a & b) + '*';
    char d = (a | b) - '-';
    char e = (a ^ b) + '+';
    printf("%c %c %c\n", c, d, e);
    return 0;
 }

ASCII encoding for relevant characters is given below :

GATE CSE 2022 Programming Languages - Basic of Programming Language Question 4 English

A
z K S
B
122 75 83
C
* $$-$$ +
D
P x +
3
GATE CSE 2015 Set 1
MCQ (Single Correct Answer)
+2
-0.6
Consider the following pseudo code, where x and y are positive integers.
begin 
    q := 0 
    r := x 
   while r ≥ y do 
      begin 
      r := r - y 
      q := q + 1 
    end 
end
The post condition that needs to be satisfied after the program terminates is
A
$$\{ r = qx + y \wedge r < y\}$$
B
$$\{ x = qy + r \wedge r < y\}$$
C
$$\{ y = qx + r \wedge 0 < r < y\}$$
D
$$\{ q + 1 < r - y \wedge y > 0\}$$
4
GATE CSE 2014 Set 2
MCQ (Single Correct Answer)
+2
-0.6
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?
A
The function returns 0 for all values of j.
B
The function prints the string something for all values of j.
C
The function returns 0 when j = 50.
D
The function will exhaust the runtime stack or run into an infinite loop when j = 50.
GATE CSE Subjects
Software Engineering
Web Technologies
EXAM MAP
Medical
NEETAIIMS
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
Civil Services
UPSC Civil Service
Defence
NDA
Staff Selection Commission
SSC CGL Tier I
CBSE
Class 12