Exam 4: C++ Programming and Concepts: Inheritance, Data Types, Objects, and Output Prediction
Exam 1: C++ Class and Function Fundamentals21 Questions
Exam 2: C++ Function and Array25 Questions
Exam 3: C++ Programming Concepts25 Questions
Exam 4: C++ Programming and Concepts: Inheritance, Data Types, Objects, and Output Prediction23 Questions
Select questions type
#include<iostream> using namespace std;class X{public:int x;};int main(){X a = {10};X b = a;cout <<a.x <<" " <<b.x; return 0;}
Free
(Multiple Choice)
4.8/5
(32)
Correct Answer:
D
Which of the following approach is adopted in C++?
Free
(Multiple Choice)
4.7/5
(38)
Correct Answer:
B
Which of the following is true about new when compared with malloc.
1) new is an operator, malloc is a function
2) new calls constructor, malloc doesn't
3) new returns appropriate pointer, malloc returns void * and pointer needs to typecast to appropriate type.
(Multiple Choice)
4.9/5
(38)
Is it fine to call delete twice for a pointer?#include<iostream> using namespace std;int main(){int *ptr = new int; delete ptr;delete ptr; return 0;}
(True/False)
4.8/5
(39)
If particular software can be used in some other application than the one for which it is created then it reveals ….........
(Multiple Choice)
4.8/5
(27)
Which of the followings is/are automatically added to every class, if we do not write our own.
(Multiple Choice)
4.8/5
(39)
Which of the following statements is correct for a static member function?
1) It can access only other static members of its class.
2) It can be called using the class name, instead of objects
(Multiple Choice)
5.0/5
(43)
Which of the following interface determines how your program will be used by other program?
(Multiple Choice)
4.8/5
(42)
What happens when delete is used for a NULL pointer? int *ptr = NULL; delete ptr;
(Multiple Choice)
4.8/5
(35)
Predict the output of following C++ program#include<iostream> using namespace std;class Empty {}; int main(){cout <<sizeof(Empty); return 0;}
(Multiple Choice)
4.7/5
(37)
Which feature of C++ contain the concept of super class and subclass?
(Multiple Choice)
4.8/5
(40)
Which of the following is true about the following program#include <iostream> class Test{public:int i;void get();};void Test::get(){std::cout <<"Enter the value of i: "; std::cin >>i;}Test t; // Global object int main(){Test t; // local object t.get();std::cout <<"value of i in local t: "<<t.i<<'\n';::t.get();std::cout <<"value of i in global t: "<<::t.i<<'\n'; return 0;}
(Multiple Choice)
4.8/5
(37)
Output of following program?#include<iostream> using namespace std; class Point {Point() { cout <<"Constructor called"; }};int main(){Point t1; return 0;}
(Multiple Choice)
5.0/5
(31)
class Test { int x;};int main(){Test t; cout <<t.x; return 0;}
(Multiple Choice)
4.8/5
(29)
Showing 1 - 20 of 23
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)