wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz on C++_1

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.
One of the concepts in "C" programming language reminds us the creation of "Class" in C++. Can you identify the C Concept from the following?
a)
Array
b)
Pointer
c)
Structure
d)
Functions
2.
This Object oriented Programming concept is a user defined data type, which has data members and member functions within it. What is that OOP concept?
a)
Object
b)
Polymorphism
c)
Data Hiding
d)
Class
3.
Which is a collection of objects of similar type?
a)
Data Member
b)
Member Function
c)
Class
d)
Inheritance
4.
The syntax for creating an object (obj) for the class (Student) is _______
a)
Student=obj;
b)
obj=Student;
c)
Student.obj;
d)
Student obj;
5.
In OOP, the concept of wrapping up of data and function into a single unit is called as __________
a)
Data Hiding
b)
Encapsulation
c)
Inheritance
d)
Polymorphism
6.
Which of the following best defines a class?
a)
Parent of an object
b)
Instance of an object
c)
Blueprint of an object
d)
Scope of an object
7.
What is the additional feature in classes that was not in structures?
a)
Data Members
b)
Member Functions
c)
Definition ending with semicolon
d)
Public Access Specifier
8.
What is default access specifier for data members or member functions declared within a class without any specifier, in C++?
a)
Private
b)
Public
c)
Protected
d)
Depends upon the compiler
9.
Which syntax for class definition is wrong?
a)
class student{ };
b)
student class{ };
c)
class student{ public: student(int a){ } };
d)
class student{ student(int a){} };
10.
Which definition best describes an object?
a)
Instance of a class
b)
Instance of itself
c)
Child of a class
d)
Overview of a class
11.
How many objects can be declared of a specific class in a single program?
a)
32768
b)
1
c)
127
d)
As many as we want
12.
How members are accessed with an object?
a)
Using dot operator
b)
Using Scope Resolution Operator
c)
Using pointers
d)
Using the member names directly
13.
Which feature of OOP indicates code reusability?
a)
Inheritance
b)
Polymorphism
c)
Encapsulation
d)
Data Hiding
14.
In C programming, the members of the structure are accessed by the variables of the structure, whereas in C++, the members of the class can be accessed by using _________
a)
pointers
b)
Destructors
c)
objects
d)
constructors
15.
When comparing C - Structures & C++ -Class, there is a significant difference in terms of their members.
a)
The members of C Structure & C++ Class are private by default
b)
The members of C Structure & C++ Class are public by default
c)
The members of C Structure are public & the members of C++ Class are private by default
d)
The members of C Structure are private & the members of C++ Class are public by default
16.
class student { private: int a; public: int b; protected: int c; }; Which datamember of the class cannot be accessed outside the class?
a)
int a
b)
int b
c)
int c
d)
all the datamembers cannot be accessed outside the class
17.
The members of the class are ______ by default
a)
private
b)
public
c)
protected
d)
based upon the compiler
18.
Which object will be created first? class student { int marks; }; student s1, s2, s3;
a)
s1 then s2 then s3
b)
s3 then s2 then s1
c)
s2 then s3 then s1
d)
all are created at same time
19.
Where is the memory allocated for the objects?
a)
HDD
b)
Cache
c)
RAM
d)
ROM
20.

When is the memory allocated for an object gets free?

a)

At termination of program

b)

When object goes out of scope

c)

When main function ends

d)

When system restarts