GRAND TEST : C-PROGRAMMING:
1#include<stdio.h>
void main()
{
clrscr();
if(printf("0"))
printf("true");
else
printf("false");
}
a)true b)0true c)false d)0
----------------------------------------------------------
2.#include<stdio.h>
void main()
{
char ch='A0';
clrscr();
printf("%d",ch);
}
a)0 b)a c)65
d)error
----------------------------------------------------------
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");
}
a)a=c b)a\/b=c c)a/b=c d)error
----------------------------------------------------------
5.#include<stdio.h>
void main()
{ clrscr();
printf("%d",1||printf("ok"));
}
a)1 b)1ok c)error d)ok1
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",sizeof(f));
}
a)4 b)8 c)6 d)error
----------------------------------------------------------
9. #include<stdio.h>
void main()
{
char ch='ab';
clrscr();
do
{
printf("%c",ch++);
}while(ch!='c'+1);}
a)abc b)ab b)abcd d)error
10. #include<stdio.h>
void main()
{
enum color{red,green=3,blue};
clrscr();
printf(“\n %d”,red+green);
}
a)5 b)3 c)0 d)none
11. #include<stdio.h>
void main()
{char ch='0a';
switch(ch)
{
case '0a':
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()
{
int i=10,j=9;
clrscr();
while(--i &&
j++);
printf("\n%d
%d",i,j);
}
a)1 19 b)0 18 c)1 10 d)1 19
16.write a
program to print . print (6
marks )
0
1 0
0 1 0
1 0 1 0
0 1 0 1 0
No comments:
Post a Comment