Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 33
1-
|
What will be the output of the program ?
#include<stdio.h>
#include<string.h>
int main()
{
char str1[20] = "Hello", str2[20] = " World";
printf("%s\n", strcpy(str2, strcat(str1, str2)));
return 0;
}
|
|
A -
|
Hello
|
|
B -
|
World
|
|
C -
|
Hello World
|
|
D -
|
WorldHello
|
2-
|
What will be the output of the program ?
#include<stdio.h>
int main()
{
char p[] = "%d\n";
p[1] = 'c';
printf(p, 65);
return 0;
}
|
|
A -
|
A
|
|
B -
|
a
|
|
C -
|
c
|
|
D -
|
65
|
3-
|
What will be the output of the program ?
#include<stdio.h>
#include<string.h>
int main()
{
printf("%d\n", strlen("123456"));
return 0;
}
|
|
A -
|
6
|
|
B -
|
12
|
|
C -
|
2
|
|
D -
|
10
|
4-
|
What will be the output of the program ?
#include<stdio.h>
int main()
{
printf(5+"Good Morning\n");
return 0;
}
|
|
A -
|
Good Morning
|
|
B -
|
Good
|
|
C -
|
M
|
|
D -
|
Morning
|
5-
|
What will be the output of the program ?
#include<stdio.h>
#include<string.h>
int main()
{
char str[] = "India\0\BIX\0";
printf("%s\n", str);
return 0;
}
|
|
A -
|
BIX
|
|
B -
|
India
|
|
C -
|
India BIX
|
|
D -
|
India\0BIX
|
6-
|
What will be the output of the program If characters 'a', 'b' and 'c' enter are supplied as input?
#include<stdio.h>
int main()
{
void fun();
fun();
printf("\n");
return 0;
}
void fun()
{
char c;
if((c = getchar())!= '\n')
fun();
printf("%c", c);
}
|
|
A -
|
abc abc
|
|
B -
|
bca
|
|
C -
|
Infinite loop
|
|
D -
|
cba
|
7-
|
What will be the output of the program ?
#include<stdio.h>
int main()
{
printf("India", "BIX\n");
return 0;
}
|
|
A -
|
Error
|
|
B -
|
India BIX
|
|
C -
|
India
|
|
D -
|
BIX
|
8-
|
What will be the output of the program ?
#include<stdio.h>
int main()
{
char str[7] = "IndiaBIX";
printf("%s\n", str);
return 0;
}
|
|
A -
|
Error
|
|
B -
|
IndiaBIX
|
|
C -
|
Cannot predict
|
|
D -
|
None of above
|
9-
|
What will be the output of the program ?
#include<stdio.h>
int main()
{
char *names[] = { "Suresh", "Siva", "Sona", "Baiju", "Ritu"};
int i;
char *t;
t = names[3];
names[3] = names[4];
names[4] = t;
for(i=0; i<=4; i++)
printf("%s,", names[i]);
return 0;
}
|
|
A -
|
Suresh, Siva, Sona, Baiju, Ritu
|
|
B -
|
Suresh, Siva, Sona, Ritu, Baiju
|
|
C -
|
Suresh, Siva, Baiju, Sona, Ritu
|
|
D -
|
Suresh, Siva, Ritu, Sona, Baiju
|
10-
|
What will be the output of the program ?
#include<stdio.h>
#include<string.h>
int main()
{
char str[] = "India\0\BIX\0";
printf("%d\n", strlen(str));
return 0;
}
|
|
A -
|
10
|
|
B -
|
6
|
|
C -
|
5
|
|
D -
|
11
|
[Người đăng: Thành Lãm - ST]
|