Explore topic-wise MCQs in C++ Programming.

This section includes 12 Mcqs, each offering curated multiple-choice questions to sharpen your C++ Programming knowledge and support exam preparation. Choose a topic below to get started.

1.

Which of the following function(s) is/are used to get the size of the array class?

A. size()
B. max_size()
C. both size() and max_size()
D. get_size()
Answer» D. get_size()
2.

Which function is used to access the last element of an array class?

A. end()
B. start()
C. back()
D. last()
Answer» D. last()
3.

Which function is used to access the first element of an array class?

A. front()
B. start()
C. back()
D. first()
Answer» B. start()
4.

What is the difference between get() and at()?

A. at() is available under <array> header file whereas get() is available under <tuple> header file
B. at() is a member function of array class whereas get() is not
C. get() takes array class as a parameter whereas at() takes a constant integer(i.e. index) as a parameter
D. all of the mentioned
Answer» E.
5.

Which header file is required to use get() function?

A. <array>
B. <tuple>
C. <Array>
D. <access>
Answer» C. <Array>
6.

What is the syntax of printing the first element of an array Arr using get() function?

A. Arr.get(0)
B. get<0>(Arr)
C. Arr.get[0]
D. get<0>[Arr]
Answer» C. Arr.get[0]
7.

What is the correct syntax of declaring an array class?

A. array<type> arr;
B. array<type,size> arr;
C. Array<type> arr;
D. Array<type,size> arr;
Answer» C. Array<type> arr;
8.

What header file is included to use array classes?

A. <array>
B. <Array>
C. <algorithm>
D. <ARRAY>
Answer» B. <Array>
9.

How many different ways are there to access an element of array classes at the ith position?

A. 1
B. 2
C. 3
D. 4
Answer» D. 4
10.

Which of the follwoing function(s) of Array classes are similar to [] operator?

A. at()
B. get()
C. both at() and get()
D. front()
Answer» D. front()
11.

Which of the following is/are advantage(s) of Sequence Container arrays over C-like arrays?

A. Sequence Container arrays store its size within itself whereas C-like arrays do not
B. Sequence Container arrays are more efficient
C. Sequence Container arrays have no array decay problem whereas C-like arrays do have
D. All of the mentioned
Answer» E.
12.

What is sequence container arrays?

A. C-like arrays
B. Template class sequence container, alternative for C-like arrays
C. Collection of data of the same type
D. Collection of objects
Answer» C. Collection of data of the same type