NEW
Font size
WorksheetsD-Bug (C++)
Total questions: 15
Worksheet time: 45mins
What will be the output of the following C++ code?
50
0
Division by zero condition
Error
What will be the output of the following C++ code?
20
An exception occurred
Error
An exception occurred 20
What will be the result of the following code snippet?
1 2 3 4 5 6 . . . . .100
1 1 1 1 . . . . . infinite times
1 0 -1 -2 -3 . . . . . till negative infinity
None of these
For which values of variable tnum will the following code become an infinite loop?
Only 0
Only 1
Only 1 or 2
Any number other than 1 or 2
What is wrong with the code?
No error
Compilation Error
Logical error
Runtime Error
Which concept is missing or not used in the below C++ script?
Polymorphism
Encapsulation
Inheritance
Abstraction
Find out the error.
`func` should contain data members
Function print(); should be predefined
Both are correct
None of these
What happens when we try to compile the class definition in following code snippet?
It will not compile because a class cannot be protectedly inherited from other class
It will not compile because class body of Eagle is not defined
It will not compile because class body of Birds is not defined
It will compile successfully
Which of the following function declarations is/are incorrect?
int Sum(int a = 0, int b, int c = 3);
int Sum(int a = 5, int b);
Both are correct
Both are incorrect
What happens if the following program is executed in C and C++?
Runs successfully in C, error in C++
Error in C, runs successfully in C++
Error in both C and C++
Runs successfully in both C and C++
What will be the output of the following C++ function?
1
0
Runtime error
Compilation error
The following program fragment:
int *a;
*a=7;
Assigns 7 to a
Results in compilation error
Logical error
Segmentation fault
What will be the output/error of the following code?
5
Run-time error
Compilation error
Segmentation Fault
What is wrong in the following line?
for(int k=0,k<=10,k++)
The increment should always be ++k
The commas should be semicolons
There should be a semicolon at the end of the statement
The variable must always be the letter i when using a for loop
What is wrong in the following line?
(x=4 && y=5) ? (a=5) : (b=6);
The question mark should be an equal sign
There are too many variables in the statement
Relational operator must be used instead of assignment operator
No error
