Skip to main content

Advanced C++ Programming Practice Questions - 899 Verified Questions

Page 1


Advanced C++ Programming Practice Questions

Course Introduction

Advanced C++ Programming delves into sophisticated concepts and modern features of the C++ language, building on foundational programming skills to develop efficient, complex, and high-performance applications. Topics covered include advanced object-oriented programming techniques, template programming, the Standard Template Library (STL), smart pointers and memory management, multithreading and concurrency, lambda expressions, move semantics, and error handling. Students will also explore design patterns, best practices for code optimization, and cross-platform development issues. Through hands-on projects and real-world examples, the course equips learners to tackle challenging software development tasks and prepares them for professional application of C++ in industry settings.

Recommended Textbook

C++ Programming From Problem Analysis to Program Design 6th Edition by D.S. Malik

Available Study Resources on Quizplus 18 Chapters

899 Verified Questions

899 Flashcards

Source URL: https://quizplus.com/study-set/1103 Page 2

Chapter 1: An Overview of Computers and Programming Languages

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/128446

Sample Questions

Q1) A program that loads an executable program into main memory is called a(n)

A) compiler

B) loader

C) linker

D) assembler

Answer: B

Q2) The term ____________________ is used to describe a program that has been written in a high-level language.

Answer: source program

source code

source

Q3) A(n) ____ consists of data and the operations on those data.

A) disk

B) compiler

C) interpreter

D) object

Answer: D

Q4) In a C++ program, statements that begin with the symbol # are called ____________________ directives.

Page 3

Answer: preprocessor

To view all questions and flashcards with answers, click on the resource link above.

Chapter 2: Basic Elements of C

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21709

Sample Questions

Q1) A mixed arithmetic expression contains all operands of the same type.

A)True

B)False

Answer: False

Q2) The expression static_cast<int>(9.9) evaluates to ____.

A) 9

B) 10

C) 9.9

D) 9.0

Answer: A

Q3) Suppose that sum is an int variable. The statement sum += 7; is equivalent to the statement sum = sum + 7;

A)True

B)False

Answer: True

Q4) A comma is also called a statement terminator.

A)True

B)False

Answer: False

To view all questions and flashcards with answers, click on the resource link above. Page 4

Chapter 3: Inputoutput

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21710

Sample Questions

Q1) In the statement cin >> x;, x can be a variable or an expression.

A)True

B)False

Answer: False

Q2) Suppose that x is an int variable, y is a double variable, z is an int variable, and the input is: 15 76.3 14

Choose the values after the following statement executes: Cin >> x >> y >> z;

A) x = 15, y = 76, z = 14

B) x = 15, y = 76, z = 0

C) x = 15, y = 76.3, z = 14

D) x = 15.0, y = 76.3, z = 14.0

Answer: C

Q3) ____ is a parameterized stream manipulator.

A) endl

B) fixed

C) scientific

D) setfill

Answer: D

To view all questions and flashcards with answers, click on the resource link above.

Page 5

Chapter 4: Control Structures I Selection

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21711

Sample Questions

Q1) The symbol > is a(n) ____________________ operator.

Q2) The operators != and == have the same order of precedence. A)True

B)False

Q3) The value of the expression 6 < 5 || 'g' > 'a' && 7 < 4 is ____________________.

Q4) Which of the following will cause a logical error if you are attempting to compare x to 5?

A) if (x == 5)

B) if (x = 5)

C) if (x <= 5)

D) if (x >= 5)

Q5) To output results correctly, the switch structure must include a(n) ____________________ statement after each cout statement, except the last cout statement.

Q6) When one control statement is located within another, it is said to be ____.

A) blocked

B) compound

C) nested

D) closed

To view all questions and flashcards with answers, click on the resource link above. Page 6

Chapter 5: Control Structures II Repetition

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21712

Sample Questions

Q1) Assume that all variables are properly declared. The following for loop executes 20 times.

for (i = 0; i <= 20; i++)

cout << i;

A)True

B)False

Q2) A loop that continues to execute endlessly is called a(n) ____ loop.

A) end

B) unhinged

C) infinite

D) definite

Q3) Which executes first in a do...while loop?

A) the statement

B) loop condition

C) the expression

D) update statement

Q4) A software ____________________ is a piece of code written on top of an existing piece of code intended to fix a bug in the original code.

Q5) The ____________________ loop has an exit condition but no entry condition.

Q6) The function eof is a member of the data type ____________________.

To view all questions and flashcards with answers, click on the resource link above. Page 7

Chapter 6: User-Defined Functions

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21713

Sample Questions

Q1) Functions that do not have a return type are called ____ functions.

A) zero

B) null

C) void

D) empty

Q2) A(n) ____________________ parameter s a formal parameter that receives a copy of the content of the corresponding actual parameter.

Q3) The standard header file for the abs(x)function is ____.

A) &lt;cmath&gt;

B) &lt;ioinput&gt;

C) &lt;cctype&gt;

D) &lt;cstdlib&gt;

Q4) A function ____________________ is a function that is not fully coded.

Q5) The heading of the function is also called the ____.

A) title

B) function signature

C) function head

D) function header

Q6) In C++, :: is called the ____________________.

8

Q7) The program that tests a function is called a(n) ____________________ program.

To view all questions and flashcards with answers, click on the resource link above.

Chapter 7: User-Defined

Simple Data Types, Namespaces, and the String Type

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21714

Sample Questions

Q1) In C++, [] is called the array subscript operator.

A)True

B)False

Q2) The general syntax for accessing a namespace member is: namespace_name->identifier.

A)True

B)False

Q3) Which of the following is a valid C++ statement?

A) typedef integer;

B) typedef int;

C) typedef int integer;

D) typedef integer int;

Q4) Consider the following statements: string str = "ABCDEFD";

String::size_type position;

After the statement position = str.find('D'); executes, the value of position is ____.

A) 3

B) 4

C) 6

D) 7

To view all questions and flashcards with answers, click on the resource link above. Page 9

Chapter 8: Arrays and Strings

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21715

Sample Questions

Q1) Consider the following declaration: int alpha[5] = {3, 5, 7, 9, 11};. Which of the following is equivalent to this statement?

A) int alpha[] = {3, 5, 7, 9, 11};

B) int alpha[] = {3 5 7 9 11};

C) int alpha[5] = [3, 5, 7, 9, 11];

D) int alpha[] = (3, 5, 7, 9, 11);

Q2) Consider the statement int list[10][8];. Which of the following about list is true?

A) list has 10 rows and 8 columns.

B) list has 8 rows and 10 columns.

C) list has a total of 18 components.

D) list has a total of 108 components.

Q3) All components of an array are of the same data type.

A)True

B)False

Q4) The function ____________________ returns the length of the string s, excluding the null character.

Q5) The header file string contains the function ____________________,which converts a value of type string to a null-terminated character array.

To view all questions and flashcards with answers, click on the resource link above. Page 10

Chapter 9: Records Structs

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21716

Sample Questions

Q1) A(n) ____________________ is a collection of a fixed number of components in which the components are accessed by name.

Q2) The components of a struct are called the ____ of the struct.

A) variables

B) identifiers

C) elements

D) members

Q3) Consider the accompanying struct definition in Figure 1. The statement ____________________ defines alumnus to be a struct variable of type newStudent.

Q4) A(n) ____________________ is a set of elements of the same type.

Q5) You can assign the value of one struct variable to another struct variable of ____ type.

A) a simple data

B) the same

C) an array

D) any

Q6) Consider the accompanying struct definition in Figure 1. The statement that initializes the member firstName to Melissa is ____________________.

To view all questions and flashcards with answers, click on the resource link above. Page 11

Chapter 10: Classes and Data Abstraction

Available Study Resources on Quizplus for this Chatper

49 Verified Questions

49 Flashcards

Source URL: https://quizplus.com/quiz/21717

Sample Questions

Q1) A(n) ____________________ is a statement specifying the condition(s) that must be true before the function is called.

Q2) The header file is also known as the ____________________.

Q3) Given the declaration class myClass { public: void print(); //Output the value of x; MyClass(); private: int x; }; myClass myObject; The following statement is legal. myObject.x = 10; A)True B)False

Q4) To create the object code file for any source code file, the command line option ____________________ is used on the system command line.

To view all questions and flashcards with answers, click on the resource link above. Page 12

Chapter 11: Inheritance and Composition

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21718

Sample Questions

Q1) Suppose that bClass is a class. Which of the following statements correctly derives the class dClass from bClass?

A) class dClass:: public bClass

//classMembersList

B) class dClass: private bClass

//classMembersList

C) class dClass:: protected bClass

//classMembersList

D) class bClass: public dClass

//classMembersList

Q2) If inheritance is public, all protected members of the base class are ____________________ members of the derived class.

To view all questions and flashcards with answers, click on the resource link above. Page 13

Chapter 12: Pointers, Classes, Virtual Functions, and

Abstract Classes

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21719

Sample Questions

Q1) If p is a pointer variable, the statement p = p + 1; is valid in C++.

A)True

B)False

Q2) Consider the following statements:

int x;

int &y = x;

The second statement declares y to be a(n) ____________________ of x.

Q3) The dereferencing operator is also known as the indirection operator and refers to the object to which its operand points.

A)True

B)False

Q4) The statement that declares board to be an array of six pointers wherein each pointer is of type int is: int ____________________;

Q5) Given the statement double *p;, the statement p++; will increment the value of p by ____ byte(s).

A) one

B) two

C) four

D) eight

To view all questions and flashcards with answers, click on the resource link above. Page 14

Chapter 13: Overloading and Templates

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21720

Sample Questions

Q1) The ____________________ operator function as a member of a class has only one parameter; as a nonmember of a class, it has two parameters.

Q2) Using a class template, you can write a single code segment for a set of related ____.

A) classes

B) functions

C) operators

D) constructors

Q3) A(n) ____ function is a nonmember function that has access to all members of the class.

A) access

B) protected

C) friend

D) void

Q4) A conversion constructor is a(n) ____________________-parameter function.

Q5) To overload a(n) ____________________ operator for a class, if the operator function is a nonmember, it has one parameter.

Q6) Passing a parameter to a class template has an effect at ____________________ time.

To view all questions and flashcards with answers, click on the resource link above. Page 15

Chapter 14: Exception Handling

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21721

Sample Questions

Q1) The class ____________________ contains the function what.

Q2) One of the typical ways of dealing with exceptions is to use an if statement. A)True

B)False

Q3) Suppose you have written a program that inputs data from a file. If the input file does not exist when the program executes, then you should choose which option?

A) Terminate the program.

B) Include code in the program to recover from the exception.

C) Log the error and continue.

D) Include code in the header file.

Q4) Which of the following blocks is designed to catch any type of exception?

A) catch(){ }

B) catch(...){ }

C) catch(*){ }

D) catch(exception){ }

Q5) All derived classes of the class exception override the function ____________________ to issue their own error messages.

Q6) If the operator new cannot allocate memory space, this operator throws a(n) ____________________ exception.

Page 16

To view all questions and flashcards with answers, click on the resource link above.

Chapter 15: Recursion

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21722

Sample Questions

Q1) The following is an example of a recursive function. void print(int x)

{ if (x > 0) { cout << x << " " ; print (x - 1); } }

A)True

B)False

Q2) A function is called ____ if it calls itself.

A) directly iterative

B) indirectly iterative

C) directly recursive

D) indirectly recursive

Q3) Recursive algorithms are implemented using ____________________ functions.

Q4) The language of a computer, called ____________________ language, is a series of 0s and 1s.

To view all questions and flashcards with answers, click on the resource link above. Page 17

Q5) The rightmost bit of the binary representation of 33 is ____________________.

Chapter 16: Searching, Sorting and the Vector Type

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21723

Sample Questions

Q1) Assume that n = 1000. To sort the list, bubble sort makes about ____ item assignments.

A) 10,000

B) 100,000

C) 250,000

D) 500,000

Q2) Which of the following statements declares intList to be a vector object of size 10?

A) vector intList();

B) vector&lt;int&gt; intList(0);

C) vector&lt;int&gt; intList(10);

D) vector&lt;int&gt; intList;

Q3) Which of the following statements declares intList to be an empty vector?

A) vector intList();

B) vector&lt;int&gt; intList(0); C) vector&lt;int&gt; intList(10); D) vector&lt;int&gt; intList;

Q4) The type vector provides the expression ____________________, which deletes the last element of vecList.

Q5) In order to apply a(n) ____________________ search, the list must be sorted.

To view all questions and flashcards with answers, click on the resource link above. Page 18

Chapter 17: Linked Lists

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21724

Sample Questions

Q1) Linked lists allow you to overcome the size limitations of an array data type.

A)True

B)False

Q2) Consider the statements above. The list is empty if the pointer first is ____.

A) NULL

B) 0

C) last D) next

Q3) In a circular linked list with more than one node, it is convenient to make the pointer first point to the ____________________ node of the list.

Q4) A doubly linked list can be traversed in either direction.

A)True

B)False

Q5) In a linked list, the ____________________ operator returns the info of the current node.

Q6) A(n) ____________________ linked list is a linked list in which every node has a next pointer and a back pointer.

Q7) The ____________________ operator advances the iterator to the next node in the linked list.

Page 19

To view all questions and flashcards with answers, click on the resource link above.

Chapter 18: Stacks and Queues

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

Source URL: https://quizplus.com/quiz/21725

Sample Questions

Q1) In evaluating a postfix expression, when an equal sign (=) is encountered, how many elements must the stack contain so that no error is generated?

A) none

B) one

C) two

D) three

Q2) If you try to add a new item to a full stack, the resulting condition is called a(n) ____.

A) override

B) overflow

C) overload

D) underflow

Q3) An array is a(n) ____________________ access data structure.

Q4) You can perform the operation ____ to remove the top element from the stack.

A) dequeue

B) top

C) pop

D) push

Q5) In ____________________ notation, operators are written after the operands.

Page 20

Q6) The operation ____________________ reinitializes a stack to an empty state.

To view all questions and flashcards with answers, click on the resource link above.

Turn static files into dynamic content formats.

Create a flipbook
Advanced C++ Programming Practice Questions - 899 Verified Questions by Quizplus - Issuu