400 Câu hỏi trắc nghiệm lập trình C/C++ có đáp án (Phần 3)
50 câu hỏi
Maximum number of arguments that a function can take is 12
Yes
No
Chọn B
Usually recursion works slower than loops
Yes
No
Chọn A
In a function two return statements should never occur.
Yes
No
Chọn B
There is a error in the below program. Which statement will you add to remove it
Add prototype: float f(int, float);
Add prototype: float f(a, b);
Add prototype: float f(float a, int b)
Chọn A
Every function must return a value
Yes
No
Chọn B
Which of the following statements are correct about the program?
It prints garbage values infinitely
Runs infinitely without printing anything
Error: main( ) cannot be called inside printf( )
No Error and print nothing
Chọn B
Will the following functions work?
Yes
No
Chọn B
If a function contains two return statements successively, the complier will generate warnings. Yes / No?
Yes
No
Chọn B
Functions can not return a floating point number
Yes
No
Chọn B
What will be the output of the program?
543210
54321
12345
Infinite loop
Chọn D
What will be the output of the program?
4
5
6
Another
Chọn A
Point out a error of the following program
Missing parenthesis in return statement
The function should be defined as int f(int a, int b)
Re-declaration of a
None of above
Chọn B
Point out the error in the program
Error: Prototype declaration
No error
Error: return statement cannot be used with conditional operators
None of above
Chọn C
What will be the output of the program?
6 6
5 6
Complier error
None of above
Chọn A
What will be output of the program?
4, 3, 4, 3
4, 4, 5, 5
3, 4, 3, 4
None of above
Chọn A
Which of the following statements are correct about this function
The function calculates the value of 1 raised to power n
The function calculates the factorial value of an integer
The function calculates the square root of an integer
None of above
Chọn B
Point out the error in the following program
Error: cannot convert ‘void’ to ‘int’
Error:
Chọn A
What will be output when you will execute following c code? Biết kích thước kiểu char : 1 byte, float : 4 byte, int : 4 byte, double : 8 byte, long : 4 byte.
8 4 1
8 2 1
4 4 1
Depend on complier
Chọn A
What will be output when you will execute following c code?
1 4 5
1 4 7
8 4 7
Another
Chọn A
What value gets printed by the program below?
1
0
0.1
Chọn B
What will be output when you will execute following c code?
-6
5
4
Another
Chọn A
What will be output when you will execute following c code?
Avatar
Alien
Error at (*)
Another
Chọn A
What will be output when you will execute following c code?
7
8
9
Another
Chọn B
What is output ?
4
0
1
5
Chọn A
What is output ?
7
6
5
1
Chọn A
What is output ?
0
Error
1
x isn’t defined
Chọn C
What is output ?
0
1
Error Comlier
Chọn A
What is output ?
1 1
1 0
‘x’ undeclared identifier
Chọn C
Output of following code?
1
0
Error
Chọn C
Output of following code?
1
Error
0
Chọn C
Output of following code?
0123456789
0000000000
0101010101
Chọn A
Output of following code?
1
5
20
‘x’ isn’t defined
Chọn B
What is output?
Garbage Garbage Garbage
5 10 15
15 10 5
Run time error
Chọn A
What is output?
c:/tc/bin/rw.c
c: c inw.c
c:cinw.c
w.c in
Chọn D
What is output ?
5
6
0
Complier error
Chọn D
What is output?
135
8
-121
121
Chọn C
What is output?
12480
1248@
12500
12522
Chọn A
What is output?
Hi
Hello
None of above
Chọn A
What is output of program?
i = 0
i = 1
Error
None of these
Chọn B
Which of the declaration is correct?
int length;
char int;
int long;
float double;
Chọn A
What is output of program?
N = 20
N = 10
Error
No Output
Chọn A
What is output of program?
0 0 0
1 2 2
1 1 1
Error
Chọn A
What is output of program?
3
4
Complier Error
3.14
Chọn B
Which of the following operations are INCORRECT?
int i = 35; i = i%5
short int j = 5; j = j;
long int k = 123L; k = k;
float a = 3.14; a = a%3;
Chọn D
Point out a error in the following program
Error: Declaration syntax error v (or) ‘v’: illegal use of type ‘void’
Program terminate abnormally
No error
None of these
Chọn A
In the following program how long will the for loop get executed?
The for loop would not get executed at all
The for loop would get executed only once
The for loop would get executed 5 times
The for loop would get executed infinite times
Chọn D
Point out the error in the following program (if it is compiled with Turbo C complier)
No error
display( ) is not declared
None of these
Chọn B
Which of the following are unary operators in C?
1. !
2. sizeof
3. ~
4. &&
1, 2
1, 3
2, 4
1, 2, 3
Chọn D
In the expression a = b = 5 the order of Assignment is NOT decided by Associativity of operators.
True
False
Chọn B
Which of the following is the correct order if calling functions in the below code?
f1, f2, f3
f3, f2, f1
Order may vary from complier to complier
None of above
Chọn C







