0% found this document useful (0 votes)
8 views

2.C++ Programming

The document contains a mock test consisting of 73 multiple-choice questions related to C++ programming, covering topics such as the developer of C++, data types, loops, arrays, and syntax. Each question provides four answer options, testing knowledge on fundamental concepts of C++. The test serves as an educational resource for individuals learning or reviewing C++ programming.

Uploaded by

vowolag578
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

2.C++ Programming

The document contains a mock test consisting of 73 multiple-choice questions related to C++ programming, covering topics such as the developer of C++, data types, loops, arrays, and syntax. Each question provides four answer options, testing knowledge on fundamental concepts of C++. The test serves as an educational resource for individuals learning or reviewing C++ programming.

Uploaded by

vowolag578
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 146

Arora Educator

C++ PROGRAMMING
Questions
Mock Test
Arora Educator
1. Who is the developer of C++?
1) Brendan Eich
2) Dennis Ritchie
3) Bjarne Stroustrup’s
4) Rasmus Lerdorf
2. In which year was developed C++ ? Arora Educator
1) 1972
2) 1979
3) 1983
4) 1995
Arora Educator
3. What was the old name of C++?
1) CPP
2) C Advanced
3) C with Classes
4) C with Programming
Arora Educator
4. In which Lab was C++ developed ?
1) ANSI
2) SDL
3) IBM
4) Bell Lab
5. In C++, cin & cout are the pre-defined stream?
1) Operator Arora Educator
2) Function
3) Object
4) Datatype
6. What is the size of int datatype in C++? Arora Educator
1) 2 Bytes
2) 4 Bytes
3) 1 Byte
4) Depends on Compiler
7. C++ is a _______ language Arora Educator
1) Object Oriented Programming
2) Semi Object Oriented Programming
3) Procedural
4) None
8. Which loop is faster in C++ Arora Educator
1) For
2) While
3) Do while
4) All work at same speed
9. Size of Turbo C/C++ Compiler ? Arora Educator
1) 16 Bit
2) 32 Bit
3) 64 Bit
4) None of these
10. ASCII value of ‘\0’ character is? Arora Educator
1) 0
2) 48
3) 32
4) 65
Arora Educator
11. Do-While loop is also known as?
1) Entry Control
2) Per Tested
3) Exit Control
4) All of these
Arora Educator
12. Range of signed char ?
1) 0 to 255
2) -128 to 127
3) 127 to -128
4) 0 to 127
13. Which of the following is the address operator?
1) @ Arora Educator
2) #
3) &
4) %
14. Which loop is guaranteed to execute at-least once?
1) For loop Arora Educator
2) While loop
3) Do while loop
4) None of these
15. Array index start at? Arora Educator
1) 1
2) 0
3) -1
4) None of these
16. Which looping process is best used when we known
the number of iterations? Arora Educator
1) While loop
2) Do while loop
3) For Loop
4) All of these
17. Which of the following is the default return value of
a function? Arora Educator
1) Void
2) Char
3) Float
4) Int
18. Which of the following will not return value?
1) Empty Arora Educator
2) Null
3) Int
4) Void
19. The value 20.58 can represented using which
datatype? Arora Educator
1) Int
2) Double
3) Void
4) None of these
20. From which function the execution of C++ program
starts? Arora Educator
1) Start()
2) New()
3) Main()
4) Sqrt()
21. Which of the following is important in a function?
1) Return type Arora Educator
2) Function Name
3) Parameter
4) Both 1 & 2
Arora Educator
22. The constants are also called as ?
1) Pre-processor
2) Const
3) Literals
4) None of these
23. An exception in C++ can be generated using which
keyword? Arora Educator
1) Throws
2) Threw
3) Catch
4) Throw
24. Int a[ ] = {5,6,7,8,9}, what is the value of a[3]?
1) 7 Arora Educator
2) 6
3) 8
4) 9
25. Void occupy how many bytes in memory ?
1) 0 Arora Educator
2) 1
3) 2
4) 4
26. Which of the following symbol is used to denote a
pre-processor statement? Arora Educator
1) %
2) $
3) #
4) @
27. C++ statement ends with? Arora Educator
1) :
2) ,
3) ;
4) $
28. Comments are used to ?
1) To help others read & understand the program
2) Make the program run faster Arora Educator
3) Make a program compile easier
4) Increase the size of code
Arora Educator
29. Syntax refers to?
1) Rules used to create a program
2) Saving program on Hard Disk
3) Both 1 & 2
4) None of these
30. How many type of error in C++? Arora Educator
1) 1
2) 2
3) 3
4) 4
31. Which of the following storage classes have global
visibility ? Arora Educator
1) Auto
2) Extern
3) Register
4) Static
32. How many type of constructor are there in C++ ?
1) 1 Arora Educator
2) 2
3) 3
4) None of these
Arora Educator
33. C++ class holds ?
1) Data
2) Function
3) 1 & 2
4) Arrays
34. Which of the following is a valid class declaration?
1) Class A {} Arora Educator
2) Class A {};
3) Class A
4) None of these
35. The data members & member functions of a class
are by default? Arora Educator
1) Protected
2) Private
3) Public
4) Both 2 & 3
36. Base class & Derive Class relationship comes under ?
1) Inheritance Arora Educator
2) Polymorphism
3) Encapsulation
4) Abstraction
37. Which of the following is the correct syntax to print
the message in C++ language? Arora Educator
1) cout <<"Hello world!";
2) Cout << Hello world! ;
3) Out <<"Hello world!;
4) None of the above
38. Which of the following comment syntax is correct to
create a single-line comment in the C++ program?
1) //Comment Arora Educator
2) /Comment/
3) Comment//
4) None of the above
39. Which of the following is the correct syntax for
printing the address of the first element? Arora Educator
1) array[0];
2) array[1];
3) array[2];
4) None of the above
Arora Educator
40. An exception is ?
1) Compile Time Error
2) Runtime Error
3) Logical Error
4) All of these
41. Which of the following features must be supported
by any programming language to become a pure object-
oriented programming language? Arora Educator
1) Encapsulation
2) Inheritance
3) Polymorphism
4) All of the above
42. Which of the following is the correct syntax to read
the single character to console in the C++ language.?
1) Read ch() Arora Educator
2) Getline vh()
3) get(ch)
4) Scanf(ch)
43. For inserting a new line in C++ program, which one
of the following statements can be used.?
1) \n Arora Educator
2) \r
3) \a
4) None of these
44. Which one of the following represents the tab.?
1) \n Arora Educator
2) \t
3) \r
4) None of the above
45. Which of the following gives the 4th element of the
array.? Arora Educator
1) Array[0];
2) Array[0];
3) Array[3];
4) None of the above
46. What is the output of the given program.?
1) -15 Arora Educator
2) -30
3) Compiler error
4) Garbage value
47. Which type of memory is used by an Array in C++
programming language.? Arora Educator
1) Contiguous
2) None-contiguous
3) Both 1 and 2
4) Not mentioned
Single Dimension arrays and Multi-Dimension arrays
Arora Educator
48. How many types of the array are
there in the C++ programming
language.?
1) In the C++ programming language,
there are three types of arrays
2) In the C++ programming language,
there are four types of arrays
3) In the C++ programming language,
there are two types of arrays
4) Both 1 and 2
49. What did we call an array of the one-dimensional
array.? Arora Educator
1) Single Dimensional array
2) Multi-Dimensional array
3) 2D Array (or 2-Dimensional array)
4) Both 1 and 2
50. Which types of arrays are always considered as
linear arrays.? Arora Educator
1) Single-dimensional
2) Multi-dimensional
3) Both 1 and 2
4) None of the above
51. Which Loop is Faster in C++? Arora Educator
1) For
2) While
3) Do While
4) All work at same speed
52. Do While Loop is a also known as Arora Educator
1) Entry Control
2) Per Tested
3) Exit Control
4) All of Above
53. Which loop is guaranteed to execute Arora Educator
at-least once?
1) for loop
2) while loop
3) do-while loop
4) None
54. How many types of loops are there Arora Educator
in C++?
1) 1
2) 2
3) 3
4) 4
55. Loop in C++ is used for Arora Educator
1) Selection
2) Decision
3) Repetition
4) None of these
56. Which of the following is NOT a loop Arora Educator
1) for
2) while
3) do while
4) while do
57. Which of the loop is also called Arora Educator
counter loop?
1) for
2) do while
3) while
4) All of these
58. One execution of the loop is known Arora Educator
as a/an?
1) Iteration
2) Test
3) Repeated
4) All of these
59. The loop which never ends is called? Arora Educator
1) Counter Loop
2) Infinite Loop
3) Nested Loop
4) None of these
60. The for loop contains _________ Arora Educator
expressions ?
1) 3
2) 4
3) 7
4) 9
61. A for loop contains three expression: Arora Educator
initialization, condition, and ?
1) Increment
2) Decrement
3) Increment/Decrement
4) Validate
62. It is the simplest loop in C++ Arora Educator
language?
1) for loop
2) while loop
3) do while
4) Nested Loop
63. Which of the following loop Arora Educator
is called entry controlled loop?
1) for loop
2) while loop
3) Both of these
4) do while loop
64. Which of the following is pre Arora Educator
tested loop in C++?
1) for loop
2) while loop
3) do while loop
4) Nested loop
65. Which of the following is post Arora Educator
tested loop in C++?
1) for loop
2) while loop
3) do while loop
4) Nested loop
66. In which loop the condition Arora Educator
comes before the body of the
loop?
1) for loop
2) while loop
3) do while loop
4) Nested loop
67. In which loop the condition comes Arora Educator
after the body of the loop?
1) for loop
2) while loop
3) do while loop
4) Nested loop
68. A loop within a loop is called Arora Educator
_______ loop.?
1) for loop
2) while loop
3) do while loop
4) Nested Loop
69. The statements within curly braces Arora Educator
in a loop is known as.?
1) Statement
2) Part
3) Body
4) All of these
70. for, while and do is the.? Arora Educator
1) Variable
2) Data Type
3) Keyword
4) All of these
71. Which is the correct.? Arora Educator
1) for(int i = 0: i<=10: i++)
2) for(int i = 0; i<=10; i++)
3) for(int i = 0; i<=10; i++);
4) for(int i = 0, i<=10; i++)
72. If you want a user to enter exactly Arora Educator
50 values, which loop would be best to
use.?
1) for Loop
2) while Loop
3) do while Loop
4) All of these
Arora Educator

C++ PROGRAMMING
Answers
Mock Test
Arora Educator
1. Who is the developer of C++?
1) Brendan Eich
2) Dennis Ritchie
3) Bjarne Stroustrup’s
4) Rasmus Lerdorf
2. In which year was developed C++ ? Arora Educator
1) 1972
2) 1979
3) 1983
4) 1995
Arora Educator
3. What was the old name of C++?
1) CPP
2) C Advanced
3) C with Classes
4) C with Programming
Arora Educator
4. In which Lab was C++ developed ?
1) ANSI
2) SDL
3) IBM
4) Bell Lab
5. In C++, cin & cout are the pre-defined stream?
1) Operator Arora Educator
2) Function
3) Object
4) Datatype
6. What is the size of int datatype in C++? Arora Educator
1) 2 Bytes
2) 4 Bytes
3) 1 Byte
4) Depends on Compiler
7. C++ is a _______ language Arora Educator
1) Object Oriented Programming
2) Semi Object Oriented Programming
3) Procedural
4) None
8. Which loop is faster in C++ Arora Educator
1) For
2) While
3) Do while
4) All work at same speed
9. Size of Turbo C/C++ Compiler ? Arora Educator
1) 16 Bit
2) 32 Bit
3) 64 Bit
4) None of these
10. ASCII value of ‘\0’ character is? Arora Educator
1) 0
2) 48
3) 32
4) 65
Arora Educator
11. Do-While loop is also known as?
1) Entry Control
2) Per Tested
3) Exit Control
4) All of these
Arora Educator
12. Range of signed char ?
1) 0 to 255
2) -128 to 127
3) 127 to -128
4) 0 to 127
13. Which of the following is the address operator?
1) @ Arora Educator
2) #
3) &
4) %
14. Which loop is guaranteed to execute at-least once?
1) For loop Arora Educator
2) While loop
3) Do while loop
4) None of these
15. Array index start at? Arora Educator
1) 1
2) 0
3) -1
4) None of these
16. Which looping process is best used when we known
the number of iterations? Arora Educator
1) While loop
2) Do while loop
3) For Loop
4) All of these
17. Which of the following is the default return value of
a function? Arora Educator
1) Void
2) Char
3) Float
4) Int
18. Which of the following will not return value?
1) Empty Arora Educator
2) Null
3) Int
4) Void
19. The value 20.58 can represented using which
datatype? Arora Educator
1) Int
2) Double
3) Void
4) None of these
20. From which function the execution of C++ program
starts? Arora Educator
1) Start()
2) New()
3) Main()
4) Sqrt()
21. Which of the following is important in a function?
1) Return type Arora Educator
2) Function Name
3) Parameter
4) Both 1 & 2
Arora Educator
22. The constants are also called as ?
1) Pre-processor
2) Const
3) Literals
4) None of these
23. An exception in C++ can be generated using which
keyword? Arora Educator
1) Throws
2) Threw
3) Catch
4) Throw
24. Int a[ ] = {5,6,7,8,9}, what is the value of a[3]?
1) 7 Arora Educator
2) 6
3) 8
4) 9
25. Void occupy how many bytes in memory ?
1) 0 Arora Educator
2) 1
3) 2
4) 4
26. Which of the following symbol is used to denote a
pre-processor statement? Arora Educator
1) %
2) $
3) #
4) @
27. C++ statement ends with? Arora Educator
1) :
2) ,
3) ;
4) $
28. Comments are used to ?
1) To help others read & understand the program
2) Make the program run faster Arora Educator
3) Make a program compile easier
4) Increase the size of code
Arora Educator
29. Syntax refers to?
1) Rules used to create a program
2) Saving program on Hard Disk
3) Both 1 & 2
4) None of these
30. How many type of error in C++? Arora Educator
1) 1
➢ Syntax Error
2) 2
3) 3 ➢ Logical error
4) 4 ➢ Runtime Error
31. Which of the following storage classes have global
visibility ? Arora Educator
1) Auto
2) Extern
3) Register
4) Static
32. How many type of constructor are there in C++ ?
1) 1 Arora Educator
2) 2
3) 3
4) None of these

➢ Default Constructor.
➢ Parametrized Constructor.
➢ Copy Constructor.
Arora Educator
33. C++ class holds ?
1) Data
2) Function
3) 1 & 2
4) Arrays
34. Which of the following is a valid class declaration?
1) Class A {} Arora Educator
2) Class A {};
3) Class A
4) None of these
35. The data members & member functions of a class
are by default? Arora Educator
1) Protected
2) Private
3) Public
4) Both 2 & 3
36. Base class & Derive Class relationship comes under ?
1) Inheritance Arora Educator
2) Polymorphism
3) Encapsulation
4) Abstraction
37. Which of the following is the correct syntax to print
the message in C++ language? Arora Educator
1) cout <<"Hello world!";
2) Cout << Hello world! ;
3) Out <<"Hello world!;
4) None of the above
38. Which of the following comment syntax is correct to
create a single-line comment in the C++ program?
1) //Comment Arora Educator
2) /Comment/
3) Comment//
4) None of the above
39. Which of the following is the correct syntax for
printing the address of the first element? Arora Educator
1) array[0];
2) array[1];
3) array[2];
4) None of the above
Arora Educator
40. An exception is ?
1) Compile Time Error
2) Runtime Error
3) Logical Error
4) All of these
41. Which of the following features must be supported
by any programming language to become a pure object-
oriented programming language? Arora Educator
1) Encapsulation
2) Inheritance
3) Polymorphism
4) All of the above
42. Which of the following is the correct syntax to read
the single character to console in the C++ language.?
1) Read ch() Arora Educator
2) Getline vh()
3) get(ch)
4) Scanf(ch)
43. For inserting a new line in C++ program, which one
of the following statements can be used.?
1) \n Arora Educator
2) \r
3) \a
4) None of these
44. Which one of the following represents the tab.?
1) \n Arora Educator
2) \t
3) \r
4) None of the above
45. Which of the following gives the 4th element of the
array.? Arora Educator
1) Array[0];
2) Array[0];
3) Array[3];
4) None of the above
46. What is the output of the given program.?
1) -15 Arora Educator
2) -30 #include < stdio.h >
3) Compiler error using namespace std;
4) Garbage value int main()
{
int array[] = {10, 20, 30};
cout << -2[array];
return 0;
}
47. Which type of memory is used by an Array in C++
programming language.? Arora Educator
1) Contiguous
2) None-contiguous
3) Both 1 and 2
4) Not mentioned
Single Dimension arrays and Multi-Dimension arrays
Arora Educator
48. How many types of the array are
there in the C++ programming
language.?
1) In the C++ programming language,
there are three types of arrays
2) In the C++ programming language,
there are four types of arrays
3) In the C++ programming language,
there are two types of arrays
4) Both 1 and 2
49. What did we call an array of the one-dimensional
array.? Arora Educator
1) Single Dimensional array
2) Multi-Dimensional array
3) 2D Array (or 2-Dimensional array)
4) Both 1 and 2
50. Which types of arrays are always considered as
linear arrays.? Arora Educator
1) Single-dimensional
2) Multi-dimensional
3) Both 1 and 2
4) None of the above
51. Which Loop is Faster in C++? Arora Educator
1) For
2) While
3) Do While
4) All work at same speed
52. Do While Loop is a also known as Arora Educator
1) Entry Control
2) Per Tested
3) Exit Control
4) All of Above
53. Which loop is guaranteed to execute Arora Educator
at-least once?
1) for loop
2) while loop
3) do-while loop
4) None
54. How many types of loops are there Arora Educator
in C++?
1) 1
2) 2
3) 3
4) 4
55. Loop in C++ is used for Arora Educator
1) Selection
2) Decision
3) Repetition
4) None of these
56. Which of the following is NOT a loop Arora Educator
1) for
2) while
3) do while
4) while do
57. Which of the loop is also called Arora Educator
counter loop?
1) for
2) do while
3) while
4) All of these
58. One execution of the loop is known Arora Educator
as a/an?
1) Iteration
2) Test
3) Repeated
4) All of these
59. The loop which never ends is called? Arora Educator
1) Counter Loop
2) Infinite Loop
3) Nested Loop
4) None of these
60. The for loop contains _________ Arora Educator
expressions ?
1) 3
2) 4
3) 7
4) 9
for(initialization expression; test expression; update expression)
{
// statements to execute in the loop body
}
61. A for loop contains three expression: Arora Educator
initialization, condition, and ?
1) Increment
2) Decrement
3) Increment/Decrement
4) Validate
62. It is the simplest loop in C++ Arora Educator
language?
1) for loop
2) while loop
3) do while
4) Nested Loop
63. Which of the following loop Arora Educator
is called entry controlled loop?
1) for loop
2) while loop
3) Both of these
4) do while loop
64. Which of the following is pre Arora Educator
tested loop in C++?
1) for loop
2) while loop
3) do while loop
4) Nested loop
65. Which of the following is post Arora Educator
tested loop in C++?
1) for loop
2) while loop
3) do while loop
4) Nested loop
66. In which loop the condition Arora Educator
comes before the body of the
loop?
1) for loop
2) while loop
3) do while loop
4) Nested loop
67. In which loop the condition comes Arora Educator
after the body of the loop?
1) for loop
2) while loop
3) do while loop
4) Nested loop
68. A loop within a loop is called Arora Educator
_______ loop.?
1) for loop
2) while loop
3) do while loop
4) Nested Loop
69. The statements within curly braces Arora Educator
in a loop is known as.?
1) Statement
2) Part
3) Body
4) All of these
70. for, while and do is the.? Arora Educator
1) Variable
2) Data Type
3) Keyword
4) All of these
71. Which is the correct.? Arora Educator
1) for(int i = 0: i<=10: i++)
2) for(int i = 0; i<=10; i++)
3) for(int i = 0; i<=10; i++);
4) for(int i = 0, i<=10; i++)
72. If you want a user to enter exactly Arora Educator
50 values, which loop would be best to
use.?
1) for Loop
2) while Loop
3) do while Loop
4) All of these

You might also like