PART—ONE (PREDICT THE OUTPUT)
Q1. What will be the output of the following arithmetic expression?
5+3*2%10-8*6
a) -37(Y)
b) -42
c) -32
d) -28
Q2. What will be the output of the following statement?
Printf (3 + "goodbye");
A) goodbye
B) odbye
C) bye
D) dbye(Y)
Q3. What will be the output of the following statements? int x[4] = {1,2,3}; printf("%d %d %D",x[3],x[2],x[1]);
a) 03%D
b) 000
c) 032(Y)
d) 321
Q4). Predict the Output? void main ()
{
int a=10,b=20; char x=1,y=0; if(a,b,x,y) { printf("EXAM"); }
}
What is the output?
1) XAM is printed
2) exam is printed
3) Compiler Error
4) Nothing is printed(Y)
Q5. What will be the output of the following statements? int i = 3; printf("%d%d",i,i++); a) 34(Y)
b) 43
c) 44
d) 33
Q6). long factorial (long x)
{
???? return x * factorial(x - 1);
}
With what do you replace the ???? to make the function shown above return the correct answer?
1)
if (x == 0) return 0;
2)
return 1;
3)
if (x >= 2) return 2;
4)
if (x <= 1) return 1;(Y)
Q7.What will be the output of the program?
#include<stdio.h>
int main()
{
typedef int LONG; LONG a=4; LONG b=68; float c=0; c=b; b+=a; printf("%d,", b); printf("%f\n", c); return 0;
}
A. 72, 68.000000 (Y)
B. 72.000000, 68
C. 68.000000, 72.000000
D. 68, 72.000000
Q8.What will be the output of the program?
#include<stdio.h>
int main()
{
float a = 0.7; if(0.7 > a) printf("Hi\n"); else printf("Hello\n"); return 0;
}
A. Hi(Y) B. Hello C. Hi Hello D. None of above
Q9.What will be output of the following c program? #include<stdio.h> int main(){ int max-val=100; int min-val=10; int avg-val; avg-val = max-val + min-val / 2; printf("%d",avg-val); return 0;
}
A) 55
B) 105
C) 60
D) Compilation error(y)
Q10.What will be the output of the program?
#include<stdio.h>
#include<stdlib.h> int main()
{
int i=0; i++; if(i<=5) {