Q1. Consider following given code and predict its output.
main()
{
int num[ ] = {1,4,8,12,16};
int a,b;
int i;
a=num;
b=num+2;
i=a+1; printf(“%d,%d,%d\n”,i,a,*b);
}
A. 2,1,8
B. 4,1,8
C. 4,4,8
D. 2,4,8
Ans. A
Q2. There is a new data-type which can take as values natural numbers between (and including) 0 and 25. How many minimum bits are required to store this datatype.
A. 4
B. 5
C. 1
D. 3
Ans. B
Q3. Stack is useful for implementing:
A. Recursion
B. Depth first search
C. Both (A) & (B)
D. Breadth first search
Ans. C
Q4. A data type is stored as an 6 bit signed integer. Which of the following cannot be represented by this data type?
A. -12
B. 0
C. 32
D. 18
Ans. C
Q5. What will be the output of the following loop?
#include<stdio.h>
main()
{
while(printf(“%d”, printf(“az”)))
printf(“by”);
}
A. None of these
B. Syntax error
C. azbyazbyazbyazby…
D. azbybyby…
Ans. C
