0

Programming Concepts

Description: C++ Programming Concepts
Number of Questions: 20
Created by:
Tags: C++ Programming Concepts
Attempted 0/20 Correct 0 Score 0

Object is a/an ____________.

  1. entity of the class

  2. instance of the class

  3. attribute of the class

  4. method of the class

  5. function of the class


Correct Option: B
Explanation:

This is the definition of an object. It uses all the properties of the class.

What feature allows us to reuse code?

  1. Data abstraction

  2. Polymorphism

  3. Inheritance

  4. Function overloading

  5. Virtual function


Correct Option: C
Explanation:

It is used for reuse the code because all the properties of the base class inherit in child class.

Which statement takes control to a particular statement?

  1. break

  2. goto

  3. continue

  4. if

  5. else


Correct Option: B
Explanation:

This is the definition of goto statement.

The concept of bundling data and function in a single unit is called __________.

  1. data abstraction

  2. encapsulation

  3. polymorphism

  4. inheritance

  5. virtual function


Correct Option: A
Explanation:

This is the definition of data abstraction, which also describes the abstract data of the class.

Which statement takes the control to the beginning of the loop?

  1. goto

  2. break

  3. continue

  4. if else

  5. switch


Correct Option: C
Explanation:

Yes, it takes the control to the beginning of the loop.

The programs are written by dividing into smaller units known as _________.

  1. procedures

  2. functions

  3. methods

  4. only 1 and 2

  5. only 1, 2 and 3


Correct Option: E
Explanation:

Procedures, functions and methods are the same and used as smaller units of a program.

Which of the following is not an advantage of Object Oriented Programming?

  1. Reusability of code

  2. Polymorphism

  3. Data abstraction

  4. Encapsulation

  5. Virtual function


Correct Option: E
Explanation:

This feature is not the advantage,  but it is related to OOPs.

Which statement takes the control out of the loop?

  1. goto

  2. continue

  3. break

  4. if else

  5. switch


Correct Option: C
Explanation:

Yes, it takes the control out of the loop.

Which header file should be included to use exit function?

  1. iostream.h

  2. stdlib.h

  3. conio.h

  4. process.h

  5. dos.h


Correct Option: D
Explanation:

It contains exit function.

Conditional operator is an alternative to __________.

  1. switch

  2. break

  3. continue

  4. if else

  5. goto


Correct Option: D
Explanation:

It is also based on true and false conditions like if and else statements.

'char st[]; is a valid statement'. This statement is

  1. true

  2. false

  3. finite

  4. infinite

  5. not define


Correct Option: B
Explanation:

It is a false statement without indexing.

void print() would return __________.

  1. null value

  2. integer

  3. float

  4. char

  5. based on function


Correct Option: A
Explanation:

The void returns no value during execution of the function.

How maximum char will allow char st[20] to be stored in the string?

  1. 20

  2. 19

  3. 18

  4. 21

  5. 17


Correct Option: B
Explanation:

This is the correct answer because one char is used for NULL. If it stores 20 char, it will become in overflow condition. It always stores the Maxlength-1 character.  

An array int a[5][6] can store __________.

  1. 29 numbers

  2. 30 numbers

  3. 31 numbers

  4. 28 numbers

  5. no number


Correct Option: B
Explanation:

It contains 5 rows and 6 column. So, it can store 30 numbers.

Index a[5] represents the number of integer in array ___________.

  1. 5

  2. 6

  3. 7

  4. 4

  5. 0


Correct Option: B
Explanation:

Array index represents a[0] to a[5] that means it represents 6 integers in array because if question is written like that int a[5], it contains only 5 elements. So, it is written as a[5] to confuse the student.

In which type of function does 'call the value' in the original variable remain the same?

  1. Pass by reference

  2. Pass by value

  3. Pass by object

  4. Pass by integer

  5. Pass by float


Correct Option: B
Explanation:

In pass by value, the value of original variable remains unchanged.

Which keyword is used to create structure?

  1. enum

  2. union

  3. array

  4. struct

  5. main


Correct Option: D
Explanation:

It is used to create structure.

When constructor is invoked, _____________.

  1. object is destroyed

  2. object is created

  3. class is destroyed

  4. class is created

  5. both object and class are created


Correct Option: B
Explanation:

It is the correct answer because constructor invoked automatically when object is created.

Which function is used to destroy the memory of an object?

  1. Constructor

  2. Destructor

  3. Virtual function

  4. Friend function

  5. Static function


Correct Option: B
Explanation:

It is used for this purpose.

By using which operator member can ' function of a class' be defined outside the class?

  1. Scope operator

  2. Resolution operator

  3. Scope resolution operator

  4. Unary operator

  5. Binary operator


Correct Option: C
Explanation:

This operator is used for this purpose.

- Hide questions