Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 16
1-
The keyword used to transfer control from a function back to the calling function is
A -
switch
B -
goto
C -
go back
D -
return
2-
What is the notation for following functions?
1. int f(int a, float b)
{
/* Some code */
}
2. int f(a, b)
int a; float b;
{
/* Some code */
}
A -
1. KR Notation 2. ANSI Notation
B -
1. Pre ANSI C Notation 2. KR Notation
C -
1. ANSI Notation 2. KR Notation
D -
1. ANSI Notation 2. Pre ANSI Notation
3-
How many times the program will print "IndiaBIX" ?
#include<stdio.h>
int main()
{
printf("IndiaBIX");
main();
return 0;
}
A -
Infinite times
B -
32767 times
C -
65535 times
D -
Till stack overflows
4-
What will be the output of the program in 16 bit platform (Turbo C under DOS)?
#include<stdio.h>
int main()
{
int fun();
int i;
i = fun();
printf("%d\n", i);
return 0;
}
int fun()
{
_AX = 1990;
}
A -
Garbage value
B -
0 (Zero)
C -
1990
D -
No output
5-
What will be the output of the program?
#include<stdio.h>
void fun(int*, int*);
int main()
{
int i=5, j=2;
fun(&i, &j);
printf("%d, %d", i, j);
return 0;
}
void fun(int *i, int *j)
{
*i = *i**i;
*j = *j**j;
}
A -
5, 2
B -
10, 4
C -
2, 5
D -
25, 4
6-
What will be the output of the program?
#include<stdio.h>
int i;
int fun();
int main()
{
while(i)
{
fun();
main();
}
printf("Hello\n");
return 0;
}
int fun()
{
printf("Hi");
}
A -
Hello
B -
Hi Hello
C -
No output
D -
Infinite loop
7-
What will be the output of the program?
#include<stdio.h>
int reverse(int);
int main()
{
int no=5;
reverse(no);
return 0;
}
int reverse(int no)
{
if(no == 0)
return 0;
else
printf("%d,", no);
reverse (no--);
}
A -
Print 5, 4, 3, 2, 1
B -
Print 1, 2, 3, 4, 5
C -
Print 5, 4, 3, 2, 1, 0
D -
Infinite loop
8-
What will be the output of the program?
#include<stdio.h>
void fun(int);
typedef int (*pf) (int, int);
int proc(pf, int, int);
int main()
{
int a=3;
fun(a);
return 0;
}
void fun(int n)
{
if(n > 0)
{
fun(--n);
printf("%d,", n);
fun(--n);
}
}
A -
0, 2, 1, 0
B -
1, 1, 2, 0
C -
0, 1, 0, 2
D -
0, 1, 2, 0
9-
What will be the output of the program?
#include<stdio.h>
int sumdig(int);
int main()
{
int a, b;
a = sumdig(123);
b = sumdig(123);
printf("%d, %d\n", a, b);
return 0;
}
int sumdig(int n)
{
int s, d;
if(n!=0)
{
d = n%10;
n = n/10;
s = d+sumdig(n);
}
else
return 0;
return s;
}