1.
What will be the output of following program ?
#include
void main()
{
if(!printf(""))
printf("Okkk");
else
printf("Hiii");
}
A. okkk
B. Hiii
C. Error
D. None
Answer: A
---------------------------------------------------------------------------------------------
2.
What will be the output of following program ?
#include
int main()
{
int a=10;
if(10L == a)
printf("10L");
else if(10==a)
printf("10");
else
printf("0");
return 0;
}
A. 10
B. 10L
C. 10L10
D. ERROR
Answer: B
----------------------------------------------------------------------------------------------
3.
Find the output?
#include
int main()
{
int pn=100;
if(pn>20)
if(pn<20 font="">20>
printf("Heyyyyy");
else
printf("Hiiiii");
return 0;
}
A. No output
B. Hiiiii
C. Heyyyyy
D. HeyyyyyHiiiii
Answer: B
---------------------------------------------------------------------------------------
4.
Find the output?
#include
#define TRUE 1
int main()
{
if(TRUE)
printf("1");
printf("2");
else
printf("3");
printf("4");
return 0;
}
A. ERROR
B. 1
C. 12
D. 2
Answer: A
-----------------------------------------------------------------------------------------
5.
Find the output?
#include
int main()
{
int a=10;
if(a==10)
{
printf("Hello...");
break;
printf("Ok");
}
else
{
printf("Hii");
}
return 0;
}
A. Hello...
B. Hello...OK
C. OK
D. ERROR
Answer: D
----------------------------------------------------------------------------------
6.
What will be output when you will execute following c code?
#define True 5==5
#include
void main(){
if(.001-0.1f)
printf("David Beckham");
else if(True)
printf("Ronaldinho");
else
printf("Cristiano Ronaldo");
}
Choose an option:
A. David Beckham
B. Ronaldinho
C. Cristiano Ronaldo
D. Warning: Condition is always true
E. Warning: Unreachable code
Answer: A,D,E
--------------------------------------------------------------------------------------------
7.
#include
void main(){
int a=100;
if(a>10)
printf("M.S. Dhoni");
else if(a>20)
printf("M.E.K Hussey");
else if(a>30)
printf("A.B. de villiers");
}
Choose all that apply:
A. M.S. Dhoni
B. A.B. de villiers
C. M.S Dhoni
M.E.K Hussey
A.B. de Villiers
D. Compilation error: More than one conditions are trueE. None
Answer: A
-------------------------------------------------------------------------------------
8.
What will be output when you will execute following c code?
#include
void main(){
if(sizeof(void))
printf("M. Muralilidaran");
else
printf("Harbhajan Singh");
}
Choose an option:
A. M. Muralilidaran
B. Harbhajan Singh
C. Warning: Condition is always false
D. Compilation error
E. None
Answer: D
------------------------------------------------
Data Types
Operators
Pointers
Array
Preprocessor
Structures