Monday, July 25, 2011

guyys.....just try it out :)

1. Which operator has the least priority?
a) Semicolon
b) Assignment
c) Comma
d) Conditional
2. What is the value of j in the following expression?
i=1;
j=i<<1%2;
a) –2
b) 2
c) 10
d) 0
3. What is the value of ‘ i ‘ in the following expression?
i=1;
i=(i<<=1%2)
a) 2
b) 1
c) syntax error
d) 0
4. From the following code
char a,b;
scanf(“%c %s”,&a,&b);
What are the values assigned to a and b, if x and y are given as inputs?
a) a=x and b=blank
b) a=x and b is not assigned
c) a=x and b=y
d) a=x and b=x
5. From the following code:
int i=20;
printf(“%x”,i);
What will be the output of the above printf statement?
a) x14
b) 14
c) 20
d) none of the above
6.
main()
{
int i=0;
for(; ++i;)
printf(“%d”,i);
}
How many times the for loop is executed
a) 0
b) 32767
c) infinite
d) The maximum unsigned integer value
7. The minimum number of inputs and outputs for a program are
a) 0,0
b) 0,1
c) 1,0
d) 1,1
8. The purpose of main () function in a C program is to
a) Initialize all variables
b) Accommodate all input/output statements
c) Initialize necessary variable and open/close files
d) Initialize necessary variables, open/close files and maintain the overall control structures
9. Which of the following are the valid character constants?
a) ‘\n’
b) ‘\\’
c) ‘\0\’
d) All the above
10. What would be the value of x after executing the following program segment?
int x,y=10; char t=’b’;
x=y+t;
a) 108
b) 10
c) 12
d) Error
11. Given a=5, b=6
What is the value of c, if C=a++ + ++b;
a) 11
b) 12
c) 10
d) 13
12. What is the output of the following statements ?
int n=64;
printf(“%04d”,n);
a) 64
b) 6400
c) 0064
d) none of the above
13. What will be the values of a, b and c printed out to the display from the following statements ?
scanf(“%2d %*d %d”,&a,&b,&c);
printf(“a=%d,b=%d,c=%d”,a,b,c);
when the values entered are 1004, 25, 64.
a) a=10, b=25, c= garbage value
b) a=10, b=4, c=25
c) a=1004, b=25, c=64
d) a=1004, b=64, c=garbage value
14. What is the output of the following program ?
int a=5;
printf(“%d, %d, %d”,a++,a,++a);
a) 5,6,7
b) 5,5,5
c) 6,6,6
d) 7,6,6
15. What would be the output of the following program?
main()
{
int i=32,j=0x20,k,l,m;
k=i j;
l=i & j;
m=k^l;
printf(“%d %d %d %d %d”,i,j,k,l,m);
}
a) 32 32 32 32 0
b) 0 0 0 0 0
c) 0 32 32 32 32
d) 32 32 32 32 32

1 comment:

  1. these r very simple questions where you have to think a little bit.....So I f u r interested post ur comments ....
    I will be updating it for sure.....

    ReplyDelete