C Expressions and Control Flow questions

Q18

GATE CS 2019 CSC ProgrammingNAT1 mark
Consider the following C program:
#include <stdio.h>
int jumble(int x, int y){
    x = 2*x + y;
    return x;
}
int main(){
    int x=2, y=5;
    y = jumble(y,x);
    x = jumble(y,x);
    printf("%d \n", x);
    return 0;
}
The value printed by the program is __________.
Show answer without attempting

Answer: 26

Q27

GATE CS 2019 CSC ProgrammingMCQ2 marks−2/3 if wrong
Consider the following C program:
#include <stdio.h>
int r(){
    static int num=7;
    return num--;
}
int main(){
    for (r();r();r())
        printf("%d",r());
    return 0;
}
Which one of the following values will be displayed on execution of the programs?
Show answer without attempting

Answer: B

Q52

GATE CS 2019 CSC ProgrammingNAT2 marks
Consider the following C program:
#include <stdio.h>
int main(){
    float sum = 0.0, j = 1.0, i = 2.0;
    while (i/j > 0.0625){
        j = j + j;
        sum = sum + i/j;
        printf("%f\n", sum);
    }
    return 0;
}
The number of times the variable sum will be printed, when the above program is executed, is __________.
Show answer without attempting

Answer: 5

0/30 correct0 marks

Related topics in C Programming