0% found this document useful (0 votes)
16 views2 pages

Exam

The document contains a series of quiz questions related to C++ programming concepts, including string length, inheritance, pointers, and exception handling. Each question is presented with multiple-choice options or true/false statements. The quiz aims to assess knowledge of C++ features and best practices.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

Exam

The document contains a series of quiz questions related to C++ programming concepts, including string length, inheritance, pointers, and exception handling. Each question is presented with multiple-choice options or true/false statements. The quiz aims to assess knowledge of C++ features and best practices.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

C++ Quiz Questions

1. The length of a string is equal to the number of its characters. (_)


2. A derived class represents a more group of objects.
• Specialized
• Generalized
• a and b
• Neither a nor b
3. Assigning a pointer of one type to a pointer of another without using a cast is a syntax error.
(_)
4. Buffer overflow is one of the common system security flaws. (_)
5. A friend declaration can appear anywhere in the class. (_)
6. As of C++11, you can now use an in-class initializer to initialize any data member where it’s
declared in the class definition. (_)
7. is not allowed.
• int**ptr1, doubleX;
• int*ptr2, *ptr3;
• char*ptr4;
• ptr5;
8. Inheritance encourages the reuse of proven high-quality software. (_)
9. The class programmer can provide to the client files in order to keep his intellectual
properties.
• Class’s source
• Class’s header
• Class’s object code
• None of the above
10. Within a class’s scope, class members are immediately accessible by all of that class’s member
functions and can be referenced by a pointer to a member. (_)
11. Built-in arrays don’t provide automatic bounds checking. (_)
12. The catch block contains the code that .
• Handles the exception if one occurs
• Contains the code that throws an exception
• a and b
• Neither a nor b
13. C++ is used for all of the following except:
• Code minimization
• Eliminating redundant checking
• Avoiding the possibility of stepping outside the array
• All of the above
14. If the same variable is declared in both class scope and member function scope, the variable
in the member function will hide the class scope variable. (_)
15. The compiler differentiates between a function that receives a pointer and a function that
receives a one-dimensional array. (_)
16. Static arrays are implicitly initialized to zero. (_)

1
17. Constructor’s member initializers are separated by semicolons. (_)

18. A base class’s private members are accessible only .


• Within the base class
• From friend classes
• a or b
• From derived classes
19. The only integer that can be assigned to a pointer without casting is 0. (_)
20. Pointers can be used to perform .

• Pass-by-reference
• Dynamic memory management
• a and b
• Neither a nor b
21. The address operator can be applied only to constants and expressions. (_)

22. Destructors are inherited from base classes. (_)


23. The statement array<int, 6> x {3, 2, 6}; generates:
• Syntax error
• Compilation error
• Logic error
• Execution error

You might also like