0% found this document useful (0 votes)
96 views7 pages

(Printf Return (0) ) : Int Main

This document contains 30 multiple choice questions about C programming and the output of various code snippets using printf statements. The questions test different aspects of printf formatting strings, order of evaluation, variable passing, preprocessor directives, and more.

Uploaded by

api-3750856
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views7 pages

(Printf Return (0) ) : Int Main

This document contains 30 multiple choice questions about C programming and the output of various code snippets using printf statements. The questions test different aspects of printf formatting strings, order of evaluation, variable passing, preprocessor directives, and more.

Uploaded by

api-3750856
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

[Q001] What will be the output of the following program :

int main()
{
printf();
return(0);
}
(a)Run-Time Error
(b)Compile-Time Error
(c)No Output
(d)None of these

[Q002] What will be the output of the following program :


int main()
{
printf(NULL);
return(0);
}
(a)Run-Time Error
(b)Compile-Time Error
(c)No Output
(d)None of these

[Q003] What will be the output of the following program :


int main()
{
printf("%%",7);
return(0);
}
(a)7
(b)Compile-Time Error
(c)%
(d)%%

[Q004] What will be the output of the following program :


int main()
{
printf("//",5);
return(0);
}
(a)5
(b)Compile-Time Error
(c)/
(d)//

[Q005] What will be the output of the following program :


int main()
{
printf("d%",8);
return(0);
}
(a)8
(b)Compile-Time Error
(c)d%
(d)None of these
[Q006] What will be the output of the following program :
int main()
{
printf("%d"+0,123);
return(0);
}
(a)123
(b)Compile-Time Error
(c)No Output
(d)None of these

[Q007] What will be the output of the following program :


int main()
{
printf("%d"+1,123);
return(0);
}
(a)123
(b)Compile-Time Error
(c)d
(d)No Output

[Q008] What will be the output of the following program :


int main()
{
printf("%d",printf("Hi!")+printf("Bye"));
return(0);
}
(a)ByeHi!6
(b)Hi!Bye6
(c)Compile-Time Error
(d)None of these

[Q009] What will be the output of the following program :


int main()
{
printf("%d",printf("Hi!")*printf("Bye"));
return(0);
}
(a)ByeHi!6
(b)Hi!Bye9
(c)Hi!Bye
(d)None of these

[Q010] What will be the output of the following program :


int main()
{
printf("%d",printf("")+printf(""));
return(0);
}
(a)0
(b)No Output
(c)Compile-Time Error
(d)None of these
[Q011] What will be the output of the following program :
int main()
{
printf("Hi Friends"+3);
return(0);
}
(a)Hi Friends
(b)Friends
(c)Hi Friends3
(d)None of these

[Q012] What will be the output of the following program :


int main()
{
printf("C For ") + printf("Swimmers");
return(0);
}
(a)Compile-Time Error
(b)C For Swimmers
(c)Run-Time Error
(d)None of these

[Q013] What will be the output of the following program :


int main()
{
printf("\/\*\-*\/");
return(0);
}
(a)Run-Time Error
(b)\/*-*\/
(c)/*-*/
(d)None of these

[Q014] What will be the output of the following program :


int main()
{
int main=7;
{
printf("%d",main);
return main;
}
printf("Bye");
return(0);
}
(a)Compile-Time Error
(b)Run-Time Error
(c)7Bye
(d)7

[Q015] What will be the output of the following program :


int main()
{
main();
return(0);
}
(a)Compile-Time Error
(b)Run-Time Error
(c)Infinite Loop
(d)None of these

[Q016] What will be the output of the following program :


int main()
{
printf("Work" "Hard");
return(0);
}
(a)Work
(b)Hard
(c)No Output
(d)WorkHard

[Q017] What will be the output of the following program :


int main()
{
char str[]="%d";
int val=25;
printf(str,val);
return(0);
}
(a)Compile-Time Error
(b)Run-Time Error
(c)25
(d)None of these

[Q018] What will be the output of the following program :


int main()
{
int val=75;
printf("%d",val,.,.);
return(0);
}
(a)Compile-Time Error
(b)Unpredictable
(c)75
(d)None of these

[Q019] What will be the output of the following program :


int main()
{
int val=10;
printf("%d",val+1,"%d",val--);
return(0);
}
(a)10
(b)11 10
(c)11 9
(d)10 9

[Q020] What will be the output of the following program :


int main()
{
int val=5;
printf("%d %d %d %d",val,--val,++val,val--);
return(0);
}
(a)3 4 6 5
(b)5 5 6 5
(c)4 4 5 5
(d)None of these

[Q021] What will be the output of the following program [NOTE : ASSUME 2 values are
entered by the user are stored in the variables 'val' & 'num' respectively] :
int main()
{
int val=5,num;
printf("%d",scanf("%d %d",&val,&num));
return(0);
}
(a)1
(b)2
(c)5
(d)None of these

[Q022] What will be the output of the following program :


#define Compute(x,y,z) (x+y-z)
int main()
{
int x=2,y=3,z=4;
printf("%d",Compute(y,z,(-x+y)) * Compute(z,x,(-y+z)));
return(0);
}
(a)40
(b)30
(c)Compile-Time Error
(d)None of these

[Q023] What will be the output of the following program :


int main()
{
int m=10,n=20;
printf("%d %d %d",m/* m-value */,/* n-value */n,m*/* Compute m*n */n);
return(0);
}
(a)Run-Time Error
(b)10 20 200
(c)Compile-Time Error
(d)None of these

[Q024] What will be the output of the following program :


int main()
{
int m=10,n=20;
/* printf("%d",m*n);
return(0);
}
(a)VALID but No Output
(b)VALID : Prints 200
(c)Compile-Time Error
(d)None of these

[Q025] What will be the output of the following program :


int main()
{
int val=97;
"Printing..."+printf("%c",val);
return(0);
}
(a)Printing...97
(b)97
(c)Compile-Time Error
(d)a

[Q026] What will be the output of the following program :


int main()
{
int val=5;
val=printf("C") + printf("Skills");
printf("%d",val);
return(0);
}
(a)Skills5
(b)C1
(c)Compile-Time Error
(d)CSkills7

[Q027] What will be the output of the following program :


int main()
{
char str[]="Test";
if ((printf("%s",str)) == 4)
printf("Success");
else
printf("Failure");
return(0);
}
(a)TestFailure
(b)TestSuccess
(c)Compile-Time Error
(d)Test

[Q028] What will be the output of the following program :


int main()
{
int val=5;
printf("%*d",val);
return(0);
}
(a)bbbbb5 (where b means blankspace)
(b)5
(c)Compile-Time Error
(d)None of these

[Q029] What will be the output of the following program :


int main()
{
int val=5;
printf("%d5",val);
return(0);
}
(a)Compile-Time Error
(b)5
(c)55
(d)bbbbb5 (where b means blankspace)

[Q030] What will be the output of the following program :


int main()
}
int val=5;
printf("%d",5+val++);
return(0);
{
(a)Compile-Time Error
(b)5
(c)10
(d)11

You might also like