

Introductory Algorithms Practice
Questions
Course Introduction
Introductory Algorithms provides a comprehensive foundation in the design, analysis, and implementation of fundamental algorithms used in computer science. Students will explore key concepts such as sorting, searching, recursion, and basic data structures, including arrays, stacks, queues, and linked lists. Emphasis is placed on algorithmic problem-solving, understanding time and space complexity, and applying mathematical reasoning to assess efficiency. The course combines theoretical lectures with practical programming exercises to develop critical thinking and coding skills necessary for tackling more advanced computational challenges.
Recommended Textbook C++ Programming From Problem Analysis to Program Design 8th Edition by D.
Available Study Resources on Quizplus
18 Chapters
751 Verified Questions
751 Flashcards
Source URL: https://quizplus.com/study-set/3129 Page 2

S. Malik

Chapter 1: An Overview of Computers and Programming Languages
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/62002
Sample Questions
Q1) Main memory is an ordered sequence of items, called ____. A) pixels
B) registers
C) memory cells
D) addresses
Answer: C
Q2) The command that does the linking on Visual C++ Express (2013 or 2016) and Visual Studio 2015 is Make or Remake.
A)True
B)False
Answer: False
Q3) When the computer is turned off, everything in secondary memory is lost.
A)True
B)False
Answer: False
Q4) Assembly language uses easy-to-remember instructions called ____________________.
Answer: mnemonics
Q5) The ASCII data set consists of ____________________ characters. Answer: 128
To view all questions and flashcards with answers, click on the resource link above. Page 3

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/62003
Sample Questions
Q1) Which of the following is the newline character?
A) \r
B) \n
C) \l
D) \b
Answer: B
Q2) The memory space for a(n) ____________________ data value is 64 bytes.
Answer: long long
Q3) Suppose a = 5. After the execution of the statement ++a; the value of a is 6.
A)True
B)False
Answer: True
Q4) If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right.
A)True
B)False
Answer: True
Q5) A(n) ____________________ is a memory location whose contents can be changed.
Answer: variable
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
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/62004
Sample Questions
Q1) Suppose that x is an int variable, y is a double variable, and z is an int variable. 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
Q2) The function ____________________ returns the next character in the input stream; it does not remove the character from the input stream.
Answer: peek
Q3) C++ provides a header file called ____________________, which is used for file I/O.
Answer: fstream
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
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/62005
Sample Questions
Q1) Suppose found = true and num = 6. The value of the expression (!found) || (num > 6) is ____________________.
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)
Q3) If the expression in an assert statement evaluates to true, the program terminates. A)True B)False
Q4) In C++, && has a higher precedence than ||. A)True B)False
Q5) Which of the following is the "not equal to" relational operator?
A) !
B) | C) !=
D) &
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
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/62006
Sample Questions
Q1) Which of the following loops does not have an entry condition?
A) EOF-controlled while loop
B) sentinel-controlled while loop
C) do...while loop
D) for loop
Q2) Which executes first in a do...while loop?
A) the statement
B) loop condition
C) the expression
D) update statement
Q3) Which of the following statements generates a random number between 0 and 50?
A) srand(time(0));
Num = rand() % 50;
B) srand(time(10));
Num = rand()/50;
C) srand(time(0));
Num = rand()50;
D) srand(time(10));
Num = rand() % 50;
Q4) 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 Function
Available Study Resources on Quizplus for this Chatper
41 Verified Questions
41 Flashcards
Source URL: https://quizplus.com/quiz/62007
Sample Questions
Q1) Given the following function prototype: Int myFunc(int, int);
Which of the following statements is valid? Assume that all variables are properly declared.
A) cin >> myFunc(y);
B) cout << myFunc(myFunc(7, 8), 15);
C) cin >> myFunc('2', '3');
D) cout << myFunc(myFunc(7), 15);
Q2) ____________________ parameters are useful in three situations:
When the value of the actual parameter needs to be changed
When you want to return more than one value from a function
When passing the address would save memory space and time relative to copying a large amount of data
Q3) The data type of a variable in a return statement must match the function type. A)True B)False
Q4) A function ____________________ is a function that is not fully coded.
Q5) The ____________________ of a function consists of the function name and its formal parameter list.
To view all questions and flashcards with answers, click on the resource link above. Page 8

Chapter 7: Namespaces, the Class String, and
User-Defined Simple Data Types
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/62008
Sample Questions
Q1) Suppose str = "ABCDEFGHI". The output of the statement cout << str.length() << endl; Is ____.
A) 7
B) 8
C) 9
D) 10
Q2) The ____ function is used to interchange the contents of two string variables.
A) iterator
B) traverse
C) swap
D) change
Q3) Considering the statement string str = "Gone with the wind";, the output of the statement cout << str.find("the") << endl; is ____.
A) 9
B) 10
C) 11
D) 12
Q4) The values in the domain of an enumeration type are called
To view all questions and flashcards with answers, click on the resource link above. Page 9

Chapter 8: Arrays
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/62009
Sample Questions
Q1) Which of the following correctly declares name to be a character array and stores "William" in it?
A) char name[6] = "William";
B) char name[7] = "William";
C) char name[8] = "William";
D) char name[8] = 'William';
Q2) In C++, the null character is represented as ____.
A) '\0'
B) "\0"
C) '0'
D) "0"
Q3) Assume you have the following declaration double salesData[1000];. Which of the following ranges is valid for the index of the array salesData?
A) 0 through 999
B) 0 through 1000
C) 1 through 1001
D) 1 through 1000
Q4) The word ____________________ is used before the array declaration in a function heading to prevent the function from modifying the 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
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/62010
Sample Questions
Q1) Arrays are passed by ____________________ only.
Q2) A struct is a(n) ____________________, not a declaration.
Q3) A function can return a value of the type array.
A)True
B)False
Q4) If a variable is passed by ____________________, then when the formal parameter changes, the actual parameter also changes.
Q5) An array name and index are separated using ____.
A) curly brackets
B) square brackets
C) a dot
D) a comma
Q6) A function can return a value of the type struct.
A)True
B)False
Q7) The components of a struct are called the ____ of the struct.
A) variables
B) identifiers
C) elements
D) members
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
43 Verified Questions
43 Flashcards
Source URL: https://quizplus.com/quiz/62011
Sample Questions
Q1) If an object is created in a user program, then the object can access both the public and private members of the class.
A)True B)False
Q2) In C++ terminology, a class object is the same as a class instance. A)True B)False
Q3) 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
Q4) A(n) ____________________ function of a class changes the values of the member variable(s) of the class.
Q5) You can use arithmetic operators to perform arithmetic operations on class objects. A)True B)False
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
41 Verified Questions
41 Flashcards
Source URL: https://quizplus.com/quiz/62012
Sample Questions
Q1) Classes can create new classes from existing classes. This important feature ____.
A) encourages code reuse
B) aids the separation of data and operations
C) provides public access to the internal state of an object
D) results in more software complexity
Q2) ____ is the ability to use the same expression to denote different operations.
A) Inheritance
B) Encapsulation
C) Polymorphism
D) Composition
Q3) In ____________________ (aggregation), one or more members of a class are objects of another class type.
Q4) A derived class can directly access the protected members of the base class.
A)True
B)False
Q5) C++ provides ____________________ functions as a means to implement polymorphism in an inheritance hierarchy.
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
43 Verified Questions
43 Flashcards
Source URL: https://quizplus.com/quiz/62013
Sample Questions
Q1) The statement that declares board to be an array of six pointers wherein each pointer is of type int is: int ____________________;
Q2) The ____________________ of a base class automatically makes the destructor of a derived class virtual.
Q3) In C++, ____ is called the address of operator.
A) &
B) *
C) #
D) ->
Q4) If p is a pointer variable, the statement p = p + 1; is valid in C++.
A)True
B)False
Q5) Which of the following would be appropriate syntax for the heading of a copy constructor for a class called rulerType?
A) rulerType(int inches, int centimeters)
B) rulerType()
C) rulerType(const rulerType& myRuler)
D) copy rulerType(int inches, int centimeters)
Q6) The binding of virtual functions occurs at program ____________________ time. Page 14
To view all questions and flashcards with answers, click on the resource link above.
Page 15

Chapter 13: Overloading and Templates
Available Study Resources on Quizplus for this Chatper
41 Verified Questions
41 Flashcards
Source URL: https://quizplus.com/quiz/62014
Sample Questions
Q1) The operators that cannot be overloaded are ., .*, ::, ?:, and
Q2) Both parameters of the function to overload the operator << are reference parameters.
A)True
B)False
Q3) The only built-in operations on classes are assignment (=) and ____________________.
Q4) Every object of a class maintains a (hidden) pointer to itself, and the name of this pointer is ____.
A) self
B) object
C) it
D) this
Q5) 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
42 Verified Questions
42 Flashcards
Source URL: https://quizplus.com/quiz/62015
Sample Questions
Q1) Which of the following is a valid C++ statement?
A) assert(0 = divisor);
B) assert(divisor != 0);
C) assert(divisor 0);
D) assert(divisor is 0);
Q2) The heading of a try block can contain ellipses in place of a parameter.
A)True
B)False
Q3) When division by zero occurs and the problem is not addressed, the program crashes with an error message that is ____ dependent.
A) code
B) computer
C) platform
D) IDE
Q4) If the operator new cannot allocate memory space, this operator throws a(n) ____________________ exception.
Q5) In C++, any class can be considered an exception class. A)True
B)False
Q6) In C++, throw is a(n) ____________________ word.
Page 17
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
41 Verified Questions
41 Flashcards
Source URL: https://quizplus.com/quiz/62016
Sample Questions
Q1) In the Tower of Hanoi problem, if needle 1 contains three disks, then the number of moves required to move all three disks from needle 1 to needle 3 is
Q2) A definition in which something is defined in terms of a smaller version of itself is called a(n) ____ definition.
A) step-wise
B) recursive
C) member-wise
D) iterative
Q3) Which of the following rules should you follow to solve the Tower of Hanoi problem?
A) Only two disks can be moved at a time.
B) You can remove disks only from the first needle.
C) The removed disk must be placed on a smaller disk.
D) A smaller disk can be placed on top of a larger disk.
Q4) If a function A calls a function B and function B calls function A, then function A is ____________________ recursive.
Q5) The ____________________ Fibonacci number in a sequence is the sum of the second and third Fibonacci numbers.
To view all questions and flashcards with answers, click on the resource link above. Page 18

Chapter 16: Searching and Sorting
Available Study Resources on Quizplus for this Chatper
46 Verified Questions
46 Flashcards
Source URL: https://quizplus.com/quiz/62017
Sample Questions
Q1) The type vector provides the function ____________________, which deletes all elements from the object.
Q2) Assume that n = 1000. To sort the list, insertion sort makes about 250,000 item assignments.
A)True
B)False
Q3) The type vector provides the expression ____________________, which returns the last element of the object.
Q4) The type vector provides the expression ____________________, which inserts a copy of elem into vecList at the end.
Q5) The type vector provides the expression ____________________, which returns true if the object vecList is empty and false otherwise.
Q6) Which statement declares intList to be a vector of size 5 and the element to be of type int?
A) vector intList[5];
B) vector<int> intList(5);
C) vector<int> intList();
D) vector(int) intList[5];
To view all questions and flashcards with answers, click on the resource link above. Page 19

Chapter 17: Linked Lists
Available Study Resources on Quizplus for this Chatper
41 Verified Questions
41 Flashcards
Source URL: https://quizplus.com/quiz/62018
Sample Questions
Q1) The steps involved in inserting a new item at the beginning of an unordered linked list are ____.
A)1.Create a new node.
2. Insert the node before first.
3. Increment the counter by 1.
B)1.Create a new node.
2. Store the new item in the new node.
3. Insert the node before first.
4. Increment the counter by 1.
C)1.Create a new node.
2. Store the new item in the new node.
3. Insert the node before first.
D)1.Create a new node.
2. Store the new item in the new node.
3. Insert the node before first.
4. Decrement the counter by 1.
Q2) When you build a linked list in the backward manner, a new node is always inserted at the end of the linked list.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above.
Page 20

Chapter 18: Stacks and Queues
Available Study Resources on Quizplus for this Chatper
42 Verified Questions
42 Flashcards
Source URL: https://quizplus.com/quiz/62019
Sample Questions
Q1) In the array representation of a stack, if a value called stackTop indicates the number of elements in the stack, then stackTop-1 points to the top item of the stack.
A)True
B)False
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) When describing a queuing system, we use the term ____________________ to refer to the time it takes to serve a customer.
Q4) A stack is a(n) ____ data structure.
A) FIFO
B) FILO
C) LIFO
D) LILO
Q5) An array is a(n) ____________________ access data structure.
Q6) In ____________________ notation, operators are written after the operands.
21
To view all questions and flashcards with answers, click on the resource link above.