Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 68
1-
Which of the following statements are correct about the below C-program?
#include<stdio.h>
int main()
{
int x = 10, y = 100%90, i;
for(i=1; i<10; i++)
if(x != y);
printf("x = %d y = %d\n", x, y);
return 0;
}
1 : The printf() function is called 10 times.
2 : The program will produce the output x = 10 y = 10
3 : The ; after the if(x!=y) will NOT produce an error.
4 : The program will not produce output.
A -
1
B -
2, 3
C -
3, 4
D -
4
2-
What will be the output of the program?
#include<stdio.h>
int main()
{
int k, num=30;
k = (num>5 ? (num <=10 ? 100 : 200): 500);
printf("%d\n", num);
return 0;
}
It prints ASCII value of the binary number present in the first byte of a float variable a.
B -
It prints character equivalent of the binary number present in the first byte of a float variable a.
C -
It will print 3
D -
It will print a garbage value
7-
Will the program compile in Turbo C?
#include<stdio.h>
int main()
{
int a=10, *j;
void *k;
j=k=&a;
j++;
k++;
printf("%u %u\n", j, k);
return 0;
}
A -
Yes
B -
No
8-
Which of the following statements are correct about an array?
1: The array int num[26]; can store 26 elements.
2: The expression num[1] designates the very first element in the array.
3: It is necessary to initialize the array at the time of declaration.
4: The declaration num[SIZE] is allowed if SIZE is a macro.
A -
2,4
B -
2,3
C -
1
D -
1,4
9-
The library function used to find the last occurrence of a character in a string is
A -
strnstr()
B -
laststr()
C -
strrchr()
D -
strstr()
10-
If char=1, int=4, and float=4 bytes size, What will be the output of the program ?