Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 84
1-
|
What will be the output of the program?
#include<stdio.h>
int main()
{
int x=1, y=1;
for(; y; printf("%d %d\n", x, y))
{
y = x++ <= 5;
}
printf("\n");
return 0;
}
|
|
A -
|
2 1 3 1 4 1 5 1 6 1 7 0
|
|
B -
|
2 1 3 1 4 1 5 1 6 1
|
|
C -
|
2 1 3 1 4 1 5 1
|
|
D -
|
2 2 3 3 4 4 5 5
|
2-
|
Which of the following is the correct order of evaluation for the below expression?
z = x + y * z / 4 % 2 - 1
|
|
A -
|
* / % + - =
|
|
B -
|
= * / % + -
|
|
C -
|
/ * % - + =
|
|
D -
|
* % / - + =
|
3-
|
Which of the following range is a valid long double ?
|
|
A -
|
1.7E-4932 to 1.7E+4932
|
|
B -
|
1.1E-4932 to 1.1E+4932
|
|
C -
|
3.4E-4932 to 3.4E+4932
|
|
D -
|
3.4E-4932 to 1.1E+4932
|
4-
|
Will the printf() statement print the same values for any values of a?
#include<stdio.h>
int main()
{
float a;
scanf("%f", &a);
printf("%f\n", a+a+a);
printf("%f\n", 3*a);
return 0;
}
|
|
A -
|
Yes
|
|
B -
|
No
|
5-
|
What will be the output of the program?
#include<stdio.h>
#include<stdlib.h>
int main()
{
int i=0;
i++;
if(i<=5)
{
printf("IndiaBIX");
exit(1);
main();
}
return 0;
}
|
|
A -
|
Prints "IndiaBIX" 5 times
|
|
B -
|
Function main() doesn't calls itself
|
|
C -
|
Infinite loop
|
|
D -
|
Prints "IndiaBIx"
|
6-
|
What will be the output of the program ?
#include<stdio.h>
int main()
{
int i, a[] = {2, 4, 6, 8, 10};
change(a, 5);
for(i=0; i<=4; i++)
printf("%d, ", a[i]);
return 0;
}
void change(int *b, int n)
{
int i;
for(i=0; i<n; i++)
*(b+1) = *(b+i)+5;
}
|
|
A -
|
7, 9, 11, 13, 15
|
|
B -
|
2, 15, 6, 8, 10
|
|
C -
|
2 4 6 8 10
|
|
D -
|
3, 1, -1, -3, -5
|
7-
|
What will be the output of the program if the array begins 1200 in memory?
#include<stdio.h>
int main()
{
int arr[]={2, 3, 4, 1, 6};
printf("%u, %u, %u\n", arr, &arr[0], &arr);
return 0;
}
|
|
A -
|
1200, 1202, 1204
|
|
B -
|
1200, 1200, 1200
|
|
C -
|
1200, 1204, 1208
|
|
D -
|
1200, 1202, 1200
|
8-
|
Which of the following is correct way to define the function fun() in the below program?
#include<stdio.h>
int main()
{
int a[3][4];
fun(a);
return 0;
}
|
|
A -
|
void fun(int p[][4]) { }
|
|
B -
|
void fun(int *p[4]) { }
|
|
C -
|
void fun(int *p[][4]) { }
|
|
D -
|
void fun(int *p[3][4]) { }
|
9-
|
What will be the output of the program ?
#include<stdio.h>
int main()
{
printf(5+"IndiaBIX\n");
return 0;
}
|
|
A -
|
Error
|
|
B -
|
IndiaBIX
|
|
C -
|
BIX
|
|
D -
|
None of above
|
10-
|
What will be the output of the program ?
#include<stdio.h>
int main()
{
enum status {pass, fail, absent};
enum status stud1, stud2, stud3;
stud1 = pass;
stud2 = absent;
stud3 = fail;
printf("%d %d %d\n", stud1, stud2, stud3);
return 0;
}
|
|
A -
|
0, 1, 2
|
|
B -
|
1, 2, 3
|
|
C -
|
0, 2, 1
|
|
D -
|
1, 3, 2
|
[Người đăng: Thành Lãm - ST]
|