Sample Questions
1) Which of the following is different from others?
a) =
b) = =
c) +=
d) *=
2) What will be the output of the following code?
#include<stdio.h>
void main(){
int x = -1;
int y=x++ && ++x || x--;
printf(“%d %d”,x,y);
}
3) What will the following program print?
#include<stdio.h>
void main(){
char a='B';
int b=a+'2';
printf(“%c”,b);
}
4) Which of the following statements is false?
a) && operator is used to combine logical expressions
b) Value of a logical expression can be true or false
c) Among all the standard operators, unary operators have the highest precedence
d) None of the above
5) What will be the output of the following code?
#include <stdio.h>
void main(){
int a = 4, b=5, c, d;
c=(a++==b)?++a:b--;
d=--c?a<=b++ && c++>=--b:a--;
printf("%d %d %d %d",a,b,c,d);
}