MCQ On C++ Tokens Expressions And Control Sturcture Part-1

This set of multiple choice questions on C++ tokens, expressions and control structure includes collections of top 20 MCQ questions on different data types user defined, built-in and derived type. User defined data type includes structure, union, class and enumeration, built-in-type includes integer type, void type and floating type.  It also includes about derived data types; array, function, pointer and reference. 
   
1. C++ provides various types of ........................ tokens that includes keywords, identifiers, constants, strings and operators.
A) tokens
B) expressions
C) structures
D) none

2. ...................... refer to the names of variables, functions, arrays, classes etc. created by programmer.
A) Keywords
B) Identifiers
C) Constants
D) Strings

3. ....................... are explicitly reserved identifiers and cannot be used as names for the program variables or other user defined program elements.
A) Keywords
B) Identifiers
C) Constants
D) Strings

4. State whether the following statements are True or False for C++ identifiers.
i) Only alphabetic characters, digits and underscores are permitted.
ii) The name can start with a digit.
iii) Uppercase and lowercase letters are distinct.
A) i-True, ii-True, iii-False
B) i-True, ii-False, iii-True
C) i-True, ii-False, iii-False
D) i-True, ii-True, iii-True

5. In C++, ....................... refer to fixed values that do not change during the execution of a program.
A) Identifiers
B) Constants
C) Strings
D) Operators

6. C++ provides an additional use of .........................., for declaration of generic pointers.
A) int
B) float
C) void
D) double

7. The ......................... data type was used to specify the return type of a function when it is not returning any value.
A) int
B) float
C) void
D) double

8. A ....................... can be assigned a pointer value of any basic data type, but it may not de-referenced.
A) int pointer
B) void pointer
C) generic pointer
D) non-void pointer

9. Which of the following is NOT the user defined data type in C++.
A) Structure
B) Pointer
C) Union
D) Class

10. Which of the following is/are the derived data types in C++.
i) array    ii) function    iii) pointer    iv) class
A) i, ii and iii only
B) ii, iii and iv only
C) i, iii and iv only
D) All i, ii, iii and iv
11. In the case of ........................... in C++, we can not modify the address that the pointer is initialized.
A) constant pointer
B) pointer to a constant
C) pointer constant
D) constant to a pointer

12. In the case of ............................ in C++, contents of what it points to cannot be changed.
A) constant pointer
B) pointer to a constant
C) pointer constant
D) constant to a pointer

13. Which of the following is the correct way of declaring constant pointer in C++.
A) char const * pointer1="OK";
B) char * const pointer1="OK";
C) const * char pointer1="OK";
D) const char * pointer1="OK";

14. Which of the following is the correct way of declaring pointer to a constant in C++.
A) int * const pointer1=&p;
B) const * int pointer1=&p;
C) int const * pointer1=&p;
D) int pointer1 * const=&p;

15. We can create .......................... in C++ using the qualifier constant and defining a set of integer constant using enum keywords.
A) basic constant
B) number constant
C) symbolic constant
D) named constant

16. The ........................ are just like variables except that their values cannot be changed.
A) basic constant
B) number constant
C) symbolic constant
D) named constant

17. ..................... are widely used in C++ for memory management and to achieve polymorphism.
A) Pointers
B) Array
C) Function
D) Class

18. C++ permits initialization of the variables at run time which is referred to as ................... initialization.
A) static
B) dynamic
C) variable
D) runtime

19. .......................... used in C++ provides an alias (alternative name) for a previously defined variables.
A) alias
B) alternative
C) defined
D) reference

20. A reference variable must be initialized at the time of ....................................
A) initialization
B) declaration
C) running
D) definition

Answers

1. A) tokens
2. B) Identifiers
3. A) Keywords
4. B) i-True, ii-False, iii-True
5. B) Constants
6. C) void
7. C) void
8. C) generic pointer
9. B) Pointer
10. A) i, ii and iii only
11. A) constant pointer
12. B) pointer to a constant
13. B) char * const pointer1="OK";
14. C) int const * pointer1=&p;
15. C) symbolic constant
16. D) named constant
17. A) Pointers
18. B) dynamic
19. D) reference
20. B) declaration

Read Next:MCQ On C++ Tokens Expressions And Control Sturcture Part-2

Read More:C and C++ MCQ Questions


MCQ On C++ Tokens Expressions And Control Sturcture Part-1
2017-04-29T04:50:00-07:00
Shuseel Baral
C & CPP|Multiple Choice Question (MCQ)|