Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 06
1-
|
How many times "IndiaBIX" is get printed?
#include<stdio.h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf("IndiaBIX");
}
return 0;
}
|
|
A -
|
Infinite times
|
|
B -
|
11 times
|
|
C -
|
0 times
|
|
D -
|
10 times
|
2-
|
How many times the while loop will get executed if a short int is 2 byte wide?
#include<stdio.h>
int main()
{
int j=1;
while(j <= 255)
{
printf("%c %d\n", j, j);
j++;
}
return 0;
}
|
|
A -
|
Infinite times
|
|
B -
|
255 times
|
|
C -
|
256 times
|
|
D -
|
254 times
|
3-
|
Which of the following is not logical operator?
|
|
A -
|
&
|
|
B -
|
&&
|
|
C -
|
||
|
|
D -
|
!
|
4-
|
In mathematics and computer programming, which is the correct order of mathematical operators ?
|
|
A -
|
Addition, Subtraction, Multiplication, Division
|
|
B -
|
Division, Multiplication, Addition, Subtraction
|
|
C -
|
Multiplication, Addition, Division, Subtraction
|
|
D -
|
Addition, Division, Modulus, Subtraction
|
5-
|
Which of the following cannot be checked in a switch-case statement?
|
|
A -
|
Character
|
|
B -
|
Integer
|
|
C -
|
Float
|
|
D -
|
enum
|
6-
|
What will be the output of the program?
#include<stdio.h>
int main()
{
int i=0;
for(; i<=5; i++);
printf("%d,", i);
return 0;
}
|
|
A -
|
0, 1, 2, 3, 4, 5
|
|
B -
|
5
|
|
C -
|
1, 2, 3, 4
|
|
D -
|
6
|
7-
|
What will be the output of the program?
#include<stdio.h>
int main()
{
char str[]="C-program";
int a = 5;
printf(a >10?"Ps\n":"%s\n", str);
return 0;
}
|
|
A -
|
C-program
|
|
B -
|
Ps
|
|
C -
|
Error
|
|
D -
|
None of above
|
8-
|
What will be the output of the program?
#include<stdio.h>
int main()
{
int a = 500, b = 100, c;
if(!a >= 400)
b = 300;
c = 200;
printf("b = %d c = %d\n", b, c);
return 0;
}
|
|
A -
|
b = 300 c = 200
|
|
B -
|
b = 100 c = garbage
|
|
C -
|
b = 300 c = garbage
|
|
D -
|
b = 100 c = 200
|
9-
|
What will be the output of the program?
#include<stdio.h>
int main()
{
unsigned int i = 65535; /* Assume 2 byte integer*/
while(i++ != 0)
printf("%d",++i);
printf("\n");
return 0;
}
|
|
A -
|
Infinite loop
|
|
B -
|
0 1 2 ... 65535
|
|
C -
|
0 1 2 ... 32767 - 32766 -32765 -1 0
|
|
D -
|
No output
|
10-
|
What will be the output of the program?
#include<stdio.h>
int main()
{
unsigned int i = 65535; /* Assume 2 byte integer*/
while(i++ != 0)
printf("%d",++i);
printf("\n");
return 0;
}
|
|
A -
|
x and y are equal
|
|
B -
|
x and y are not equal
|
|
C -
|
Unpredictable
|
|
D -
|
No output
|
[Người đăng: Thành Lãm - ST]
|