Advanced Programming With C++ MCQ PDF
Advanced Programming With C++ MCQ PDF
[Link]
21 Chapters
1050 Verified Questions
Advanced Programming with C++
MCQ PDF
Cou
Advanced Programming with C++ delves into sophisticated concepts and practices
essential for mastering C++ as a powerful programming language. The course covers
including pointers, dynamic allocation, and smart pointers, as well as the Standard
Template Library (STL) for efficient coding. Students will also explore multi-threading, file
handling, and best practices for large-scale software development. By the end of the
Recommended Textbook
C++ Programming Program Design Including Data Structures 6th Edition by D.S. Malik
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: [Link]
Sample Questions
Q1) Main memory is called ____.
A) read only memory
B) random access memory
C) read and write memory
D) random read only memory
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) The ____________________ monitors the overall activity of the computer and
provides services such as memory management,input/output activities,and storage
management.
Answer: operating system
OS
Page 4
Chapter 2: Basic Elements of C++
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]
Sample Questions
Q1) The ____________________ type is C++ 's method for allowing programmers to
create their own simple data types.
Answer: enumeration
Q2) A mixed arithmetic expression contains all operands of the same type.
A)True
B)False
Answer: False
Q4) Suppose that sum is an int [Link] statement sum += 7; is equivalent to the
statement sum = sum + 7;
A)True
B)False
Answer: True
To view all questions and flashcards with answers, click on the resource link above.
Chapter 3: Input/Output
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]
Sample Questions
Q1) The number of input data extracted by cin and >> depends on the number of
variables appearing in the cin statement.
A)True
B)False
Answer: True
To view all questions and flashcards with answers, click on the resource link above.
Page 6
Chapter 4: Control Structures I (Selection)
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]
Sample Questions
Q1) What does <= mean?
A) less than
B) greater than
C) less than or equal to
D) greater than or equal to
Q2) 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)
Q4) A control structure alters the normal sequential flow of execution in a program.
A)True
B)False
Sample Questions
Q1) What is the output of the following C++ code? int j;
For (j = 10; j <= 10; j++)
\(\quad\)Cout << j << " ";
Cout << j << endl;
A) 10
B) 10 10
C) 10 11
D) 11 11
Q4) The ____________________ loop has an exit condition but no entry condition.
Q5) In a while and for loop,the loop condition is evaluated before executing the body of
the [Link],while and for loops are called ____________________ loops.
Sample Questions
Q1) A variable for which memory remains allocated as long as the program executes is
called a(n)____________________ variable.
Sample Questions
Q1) An enumeration type can be passed as a parameter to a function only by value.
A)True
B)False
Q4) The data type string has a named constant,____,associated with it.
A) string::size
B) string::size_type
C) string::pos
D) string::npos
Page 10
Q5) The string expression strVar.____________________ returns the index of the
first occurrence at or after pos where str is found in strVar.
To view all questions and flashcards with answers, click on the resource link above.
Chapter 8: Arrays and Strings
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]
Sample Questions
Q1) The array index can be any integer less than the array size.
A)True
B)False
Q2) Suppose that list is an array of 10 components of type [Link] of the following
codes correctly outputs all the elements of list?
A) for (int j = 1; j < 10; j++)
\(\quad\)\(\quad\)cout << list[j] << " ";
\(\quad\)cout << endl;
B) for (int j = 0; j <= 9; j++)
\(\quad\)\(\quad\)Cout << list[j] << " ";
\(\quad\)cout << endl;
C) for (int j = 1; j < 11; j++)
\(\quad\)\(\quad\)cout << list[j] << " ";
\(\quad\)cout << endl;
D) for (int j = 1; j <= 10; j++)
\(\quad\)\(\quad\)cout << list[j] << " ";
\(\quad\)cout << endl;
To view all questions and flashcards with answers, click on the resource link above.
Page 11
Chapter 9: Records (structs)
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]
Sample Questions
Q1) Consider the following statements: struct rectangleData
{
\(\quad\)double length;
\(\quad\)double width;
\(\quad\)double area;
\(\quad\)double perimeter;
};
rectangleData bigRect;
Which of the following statements correctly initializes the component length of bigRect?
A) bigRect = {10};
B) [Link] = 10;
C) length[0]= 10;
D) bigRect[0]= 10
Q2) Consider the accompanying struct [Link] statement that assigns the
average of testScore and programmingScore to score is ____________________.
Q3) Both arrays and structs are examples of ____________________ data types.
Q4) You can declare struct variables when you define a struct.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above.
Page 12
Chapter 10: Classes and Data Abstraction
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]
Sample Questions
Q1) Consider the accompanying class definition in Figure [Link] of the following
variable declarations is correct?
A) rectangle rectangleType;
B) class rectangleType rectangle;
C) rectangleType rectangle;
D) rectangle [Link];
Q3) A program or software that uses and manipulates the objects of a class is called
a(n)____________________ of that class.
Q4) In C++,you can pass a variable by reference and still prevent the function from
changing its value by using the keyword ____ in the formal parameter declaration.
A) automatic
B) private
C) static
D) const
To view all questions and flashcards with answers, click on the resource link above.
Page 13
Chapter 11: Inheritance and Composition
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]
Sample Questions
Q1) If the corresponding functions in the base class and the derived class have the same
name but different sets of parameters,then this function is ____ in the derived class.
A) reused
B) redefined
C) overloaded
D) overridden
Page 14
Q8) Objects are created when ____________________ variables are declared.
To view all questions and flashcards with answers, click on the resource link above.
Chapter 12: Pointers, Classes, Virtual Functions, Abstract
Sample Questions
Q1) The binding of virtual functions occurs at program ____________________
time.
Q3) For classes with pointer member variables,you should include the copy constructor
and the ____________________ in the class.
To view all questions and flashcards with answers, click on the resource link above.
Chapter 13: Overloading and Templates
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]
Sample Questions
Q1) Which of the following is the general syntax of the function prototype to overload the
post-increment operator as a member function?
A) className operator++();
B) friend className operator++();
C) className operator++(int);
D) friend className operator++(int);
Q2) The name of the function to overload the operator <= is ____.
A) overload<=
B) <=new
C) operator<=
D) <=operator
Q3) If you overload the binary arithmetic operator + as a member function,how many
objects must be passed as parameters?
A) none
B) one
C) two
D) three
To view all questions and flashcards with answers, click on the resource link above.
Page 16
Chapter 14: Exception Handling
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]
Sample Questions
Q1) If you want to include members in your exception class,you typically include the
function ____.
A) that
B) this
C) log
D) what
Q4) The class ____________________ deals with the string subscript out of range
error.
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: [Link]
Sample Questions
Q1) The numbering system that the computer uses is called the
____________________ system.
To view all questions and flashcards with answers, click on the resource link above.
Page 18
Chapter 16: Linked Lists
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]
Sample Questions
Q1) Which of the following is a basic operation on singly linked lists?
A) Retrieve the data of an arbitrary node.
B) Swap the head and the last nodes.
C) Determine whether the list is full.
D) Make a copy of the linked list.
Q2) A(n)____________________ linked list is a linked list in which every node has a
next pointer and a back pointer.
Q3) Consider the accompanying [Link] is the effect of the following statement?
newNode->info = 50;
A) Stores 50 in the info field of the newNode
B) Creates a new node
C) Places the node at location 50
D) Cannot be determined from this code
Q5) 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.
Page 19
To view all questions and flashcards with answers, click on the resource link above.
Chapter 17: Stacks and Queues
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]
Sample Questions
Q1) A queue is a First In First Out data structure.
A)True
B)False
Q2) You can perform the add operation,called ____,to add an element onto the stack.
A) pop
B) push
C) enqueue
D) dequeue
Sample Questions
Q1) In the case of an unsuccessful search,it can be shown that for a list of length n,a
binary search makes approximately ____________________ key comparisons.
Q2) Assume that list consists of the following [Link] is the result after bubble
sort completes? int list[] = {2,56,34,25,73,46,89,10,5,16};
A) 89 73 56 46 34 25 16 10 5 2
B) 2 56 34 25 5 16 89 46 73
C) 2 5 10 16 25 34 46 56 73 89
D) 2 10 16 25 34 46 56 73 89
Q3) In general,the selection sort algorithm is good only for small lists because
____________________ grows rapidly as n grows.
Q4) After the second iteration of bubble sort for a list of length n,the last ____ elements
are sorted.
A) two
B) three
C) n-2
D) n
Q6) The top node of a comparison tree is call the ____________________ node.
Page 21
To view all questions and flashcards with answers, click on the resource link above.
Chapter 19: Binary Trees
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]
Sample Questions
Q1) The operations to do inorder,preorder,and postorder traversals of a binary search
tree are the same as those for a binary tree.
A)True
B)False
Q2) A pointer to the root node of the binary tree is stored outside the binary tree in a
pointer variable,usually called the ____.
A) node
B) parent
C) root
D) nodeType
Sample Questions
Q1) A graph is ____________________ if the number of vertices is zero.
Q2) In Prim's algorithm for the minimal spanning tree,we start at a designated
vertex,which we call the ____ vertex.
A) index
B) source
C) root
D) destination
Page 23
To view all questions and flashcards with answers, click on the resource link above.
Chapter 21: Standard Template Library (STL)
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]
Sample Questions
Q1) ____________________ predicates check a specific property for a pair-that
is,two arguments.
Q2) The class ____ contains the definition of an output stream iterator.
A) iostream
B) iostream_iterator
C) ostream
D) ostream_iterator
Q5) The [Link]()operation on a deque object checks whether the container is empty.
A)True
B)False
Page 24
To view all questions and flashcards with answers, click on the resource link above.