1#include<stdio.h>
void main()
{
clrscr();
if((2==2) && printf("0") || 0)
printf("true");
else
printf("false");
}
a)true b)0true c)false d)0
----------------------------------------------------------
2.#include<stdio.h>
void main()
{
int ch='\0';
clrscr();
ch++;
while(1 && ch)
printf("%d",ch--);
}
a)NULLb)0 c)1 d)infinate loop
----------------------------------------------------------
3.#include<stdio.h>
void main()
{
int ch=NULL || EOF+1 && EOF ;
clrscr();
printf("%d",ch);
}
a)0 b)1 c)-1 d)48
----------------------------------------------------------
4.#include<stdio.h>
void main()
{ printf("a\/b=c",'%d',"%d");
}
a)a=c b)a\/b=c c)a/b=c
d)error
----------------------------------------------------------
5.#include<stdio.h>
void main()
{ clrscr();
printf("%d",1||-?('\n'==10!=0):printf("ok"));
}
a)1 b)0 c)error d)ok
6.#include<stdio.h>
void main()
{
float x=10.2345F;
int a;
clrscr();
a=x-(int)x;
printf("\n%f",(float)a);
}
a)10.234500 b)0.000000
c)error d)10.2345
7.#include<stdio.h>
void main()
{
clrscr();
printf("a%cb",'\\b');
}
a)a\b b)a\\b c)b d)error
8.#include<stdio.h>
void main()
{
float f=2.0;
clrscr();
printf("%d\t\t%d",a,sizeof(2.0f+2));
}
a)4 b)8 c)6 d)error
----------------------------------------------------------
9. #include<stdio.h>
void main()
{
char ch='ab';
clrscr();
do
{
}while(ch!='c'+1);}
a)abc b)ab b)abcd d)error
10. #include<stdio.h>
void main()
{
int i,no=0;
clrscr();
for(i=0;i<=5;no+=i++,i==5?
printf("%d",no):0);
}
a)15 b)10 c)100 d)150
11. #include<stdio.h>
void main()
{char ch='0a';
switch(ch)
{
case '0a':
16. #include <stdio.h>
int main()
{
int i=10,j=9;
clrscr();
puts("\nfirst"); break;
case 48:
puts("\nsecond");break;
default:printf("wrong");
}
}
a)first b)wrong c)error d)second
12. #include<stdio.h>
void main()
{
int a=5^8;
printf("%d",a*a);
}
a)13 b)169 c)-169 d)-13
13. #include <stdio.h>
int main()
{ int i = 0, j = 0;
while (i < 5, j < 10)
{
i++; j++;
}
printf("%d, %d\n", i, j);
}
a)0,0 b)5,5 c)10,10 d)error
14. #include <stdio.h>
int main()
{ int a=7,b=2;
printf("\n%d",(int)((float)a/b-(int)a/b));
}
a)0.5 b)0 c)0.500000 d)error
15. #include <stdio.h>
int main() {
}
a)1 19 b)0 18 c)1 10 d)1 19
17. #include <stdio.h>
int main()
{
int a = 6;
int b = 12;
clrscr();
while(a<b){
printf("\n%d %d",a,b,a+=2,b-=2);
}
}
How many loops took in the above program
a)1 b)2 c)3 d)0
18. #include <stdio.h>
int main()
{ do
}
a)a\bc b)c c)a\b d)error
if(1)
if(0);
else if(1)
printf("\nOver");
else;
}
a)Over b)syntax missing error c)nothing d)
misplaced else
19.write a program to print
54321012345 (use only one for)
20. print
0
1 0
0 1 0
1 0 1 0
0 1 0 1 0
void main()
{
clrscr();
if((2==2) && printf("0") || 0)
printf("true");
else
printf("false");
}
a)true b)0true c)false d)0
----------------------------------------------------------
2.#include<stdio.h>
void main()
{
int ch='\0';
clrscr();
ch++;
while(1 && ch)
printf("%d",ch--);
}
a)NULLb)0 c)1 d)infinate loop
----------------------------------------------------------
3.#include<stdio.h>
void main()
{
int ch=NULL || EOF+1 && EOF ;
clrscr();
printf("%d",ch);
}
a)0 b)1 c)-1 d)48
----------------------------------------------------------
4.#include<stdio.h>
void main()
{ printf("a\/b=c",'%d',"%d");
}
a)a=c b)a\/b=c c)a/b=c
d)error
----------------------------------------------------------
5.#include<stdio.h>
void main()
{ clrscr();
printf("%d",1||-?('\n'==10!=0):printf("ok"));
}
a)1 b)0 c)error d)ok
6.#include<stdio.h>
void main()
{
float x=10.2345F;
int a;
clrscr();
a=x-(int)x;
printf("\n%f",(float)a);
}
a)10.234500 b)0.000000
c)error d)10.2345
7.#include<stdio.h>
void main()
{
clrscr();
printf("a%cb",'\\b');
}
a)a\b b)a\\b c)b d)error
8.#include<stdio.h>
void main()
{
float f=2.0;
clrscr();
printf("%d\t\t%d",a,sizeof(2.0f+2));
}
a)4 b)8 c)6 d)error
----------------------------------------------------------
9. #include<stdio.h>
void main()
{
char ch='ab';
clrscr();
do
{
}while(ch!='c'+1);}
a)abc b)ab b)abcd d)error
10. #include<stdio.h>
void main()
{
int i,no=0;
clrscr();
for(i=0;i<=5;no+=i++,i==5?
printf("%d",no):0);
}
a)15 b)10 c)100 d)150
11. #include<stdio.h>
void main()
{char ch='0a';
switch(ch)
{
case '0a':
16. #include <stdio.h>
int main()
{
int i=10,j=9;
clrscr();
puts("\nfirst"); break;
case 48:
puts("\nsecond");break;
default:printf("wrong");
}
}
a)first b)wrong c)error d)second
12. #include<stdio.h>
void main()
{
int a=5^8;
printf("%d",a*a);
}
a)13 b)169 c)-169 d)-13
13. #include <stdio.h>
int main()
{ int i = 0, j = 0;
while (i < 5, j < 10)
{
i++; j++;
}
printf("%d, %d\n", i, j);
}
a)0,0 b)5,5 c)10,10 d)error
14. #include <stdio.h>
int main()
{ int a=7,b=2;
printf("\n%d",(int)((float)a/b-(int)a/b));
}
a)0.5 b)0 c)0.500000 d)error
15. #include <stdio.h>
int main() {
}
a)1 19 b)0 18 c)1 10 d)1 19
17. #include <stdio.h>
int main()
{
int a = 6;
int b = 12;
clrscr();
while(a<b){
printf("\n%d %d",a,b,a+=2,b-=2);
}
}
How many loops took in the above program
a)1 b)2 c)3 d)0
18. #include <stdio.h>
int main()
{ do
}
a)a\bc b)c c)a\b d)error
if(1)
if(0);
else if(1)
printf("\nOver");
else;
}
a)Over b)syntax missing error c)nothing d)
misplaced else
19.write a program to print
54321012345 (use only one for)
20. print
0
1 0
0 1 0
1 0 1 0
0 1 0 1 0
No comments:
Post a Comment