4 Objective type interview questions on C/C++ with answers
Before you start:-
- You can check your answer by filling a,b,c,d or e in the text box.
- You can get the answer by clicking Give Up Button.
Try yourself before giving up 🙂
Q1)
#include
int main(){
char a[5]="hello";
printf("%s",a);
}
Options: a) will print “hello” only b) will print some garbage values c) will print “hello” atleast d) None
Q2)
#include
int main(){
char *a="Hello" "India";
printf("%s",a);
}
Options: a) Hello India b) HelloIndia c) Compilation error d) Run-time error
#include
int main(){
int i = 2;
int z = ++i + i++;
printf("%d,%d", z, i);
}
Options: a) 5,4 b) 4,4 c) 7,4 d) 6,4 e) 5,3
Q4)
#include
main()
{
int x=5;
printf("%d %d %d\n",x,x<<2,x>>2);
}
Options: a) 5 20 16 b) 5 1 20 c) 5 10 2 d) 5 20 1 e) 4 4 1
Facebook Comments



