Programmers At War

Programmers At War: Challenge Your Knowledge!
Test your programming skills with our engaging quiz designed for both novice and experienced developers. Dive deep into a variety of questions that cover the intricacies of C++ programming.
- 10 thought-provoking questions
- Multiple choice format
- Instant feedback on your answers
#include
using namespace std;
int main ()
{ int cin;
cin >> cin;
cout << "cin" << cin;
return 0;
}
error in using cin keyword
Cin+junk value
Cin+input
Runtime error
#include<iostream>
using
namespace
std;
int
x[100];
int
main()
{
cout << x[99] << endl;
}
Unpredictable
Runtime error
0
99
#include <iostream>
#include <vector>
using
namespace
std;
class
a
{
public
:
~a()
{
cout <<
"destroy"
;
}
};
int
main()
{
vector <a*> *v1 =
new
vector<a*>;
vector <a> *v2 =
new
vector<a>;
return
0;
}
v1
V2
V1 and v2
No destructor call
#include <iostream> int const s=9; int main() { std::cout << s; return 0; } |
9
Compiler Error
Run Time Error
None of the above
#include <iostream>
class
Test
{
public
:
void
fun();
};
static
void
Test::fun()
{
std::cout<<
"fun() is static\n"
;
}
int
main()
{
Test::fun();
return
0;
}
fun() is static
Empty Screen
Compiler Error
None Of the above
#include<iostream>
using
namespace
std;
int
main()
{
int
x = 10;
int
& ref = x;
ref = 20;
cout <<
"x = "
<< x << endl ;
x = 30;
cout <<
"ref = "
<< ref << endl;
return
0;
}
X = 20 ref = 30
X = 20 ref = 20
X = 10 ref = 30
X = 30 ref = 30
#include<iostream> using namespace std; class Base1 { public : char c; }; class Base2 { public : int c; }; class Derived: public Base1, public Base2 { public : void show() { cout << c; } }; int main( void ) { Derived d; d.show(); return 0; } |
Compiler Error in “cout << c;"
Garbage Value
Compiler Error in “class Derived: public Base1, public Base2”
Which of the following operators are overloaded by default by the compiler in every user defined classes even if user has not written?
1) Comparison Operator ( == ) 2) Assignment Operator ( = )
Both 1 and 2
Only 1
Only 2
None of the two
How can we make a C++ class such that objects of it can only be created using new operator?
If user tries to create an object directly, the program produces compiler error.
Not possible
By making destructor private
By making constructor private
By making both constructor and destructor private
#include<iostream> using namespace std; int x = 1; void fun() { int x = 2; { int x = 3; cout << ::x << endl; } } int main() { fun(); return 0; }
1
2
3
0
{"name":"Programmers At War", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your programming skills with our engaging quiz designed for both novice and experienced developers. Dive deep into a variety of questions that cover the intricacies of C++ programming.10 thought-provoking questionsMultiple choice formatInstant feedback on your answers","img":"https:/images/course4.png"}
More Surveys
Design Patterns Quiz
10524
Chapter 2 Meaningful Names & Chapter 3 Functions
10511
Behavioral & Structural Design Pattern Quiz Quiz
10516
Linting rules
10510
ISTQB Test
11616
The Scrum Framework
1477
Test automation training - entry knowledge check
10525
Agile Maturity Test
1050
CA process
1366
Client Data Protection Awareness
17844
The Greatest Lawn Care Characters in T.V. & Film History
100
Survey
1050
Make your own Survey
- it's free to start.
- it's free to start.