Skip to main content

Problem Solving with C++ Exam Preparation Guide - 949 Verified Questions

Page 1


Problem Solving with C++ Exam Preparation Guide

Course Introduction

This course introduces students to the fundamental concepts of programming and computational problem-solving using the C++ language. Through a series of hands-on assignments and projects, students will learn to analyze problems, design algorithms, and implement solutions efficiently in C++. Topics covered include variables and data types, control structures, functions, arrays, pointers, and an introduction to object-oriented programming. Emphasis is placed on logical thinking, developing robust code, and understanding the underlying mechanisms of how C++ executes programs. This course provides a solid foundation for further studies in computer science and engineering.

Recommended Textbook

Starting Out with C++ from Control Structures to Objects 9th Edition by Tony Gaddis

Available Study Resources on Quizplus

21 Chapters

949 Verified Questions

949 Flashcards

Source URL: https://quizplus.com/study-set/1368

2

Chapter 1: Introduction to Computers and Programming

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

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

Sample Questions

Q1) The purpose of a memory address is:

A) to identify the location of a byte in memory

B) to prevent multitasking

C) to obtain an algorithm

D) to improve the speed of processing

E) None of these

Answer: A

Q2) A computer stores a program while it is running

A) in main memory

B) on a hard disk

C) on the computer monitor

D) in the CPU

E) None of these

Answer: A

Q3) In C++, key words are written in all lowercase letters.

A)True

B)False

Answer: True

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

3

Chapter 2: Introduction to C

Available Study Resources on Quizplus for this Chatper

62 Verified Questions

62 Flashcards

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

Sample Questions

Q1) What will be the output after the following lines of code execute?

bool choice; choice = true;

cout << "Your choice is " << choice << endl;

A) true

B) Your choice is true

C) Your choice is 1

D) Your choice is choice

E) None of these

Answer: C

Q2) Data items whose values do not change while the program is running are A) literals

B) variables

C) characters

D) integers

E) None of these

Answer: A

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

Page 4

Chapter 3: Expressions and Interactivity

Available Study Resources on Quizplus for this Chatper

45 Verified Questions

45 Flashcards

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

Sample Questions

Q1) If you want to know the length of the string that is stored in a string object, you can call the object's size member function.

A)True

B)False

Answer: False

Q2) The function pow(x, y), requires which header file?

A) cstdlib

B) cstring

C) iostream

D) cmath

E) iomanip

Answer: D

Q3) This manipulator forces cout to print digits in fixed-point notation:

A) setprecision(2)

B) setw(2)

C) fixed

D) setfixed(2)

E) None of these

Answer: C

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

Page 5

Chapter 4: Making Decisions

Available Study Resources on Quizplus for this Chatper

51 Verified Questions

51 Flashcards

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

Sample Questions

Q1) The default section is required in a switch statement.

A)True

B)False

Q2) This operator takes an operand and reverses its truth or Falsehood: A) !&

B) ||

C) =!

D) !

E) None of these

Q3) If the expression on the left side of the following is true, the expression on the right side will not be checked. (a > = b) || (c == d)

A)True

B)False

Q4) The following code correctly determines whether x contains a value in the range of 0 through 100, inclusive. if (x > 0 && <= 100)

A)True

B)False

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

Chapter 5: Loops and Files

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

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

Sample Questions

Q1) What will the following code display? int number = 6; ++number;

cout << number << endl;

A) 6

B) 5

C) 7

D) 0

Q2) An initialization expression may be omitted from the for loop if no initialization is required.

A)True

B)False

Q3) What will the following code display? int number = 6; number++;

cout << number << endl;

A) 6

B) 5

C) 7

D) 0

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

Chapter 6: Functions

Available Study Resources on Quizplus for this Chatper

49 Verified Questions

49 Flashcards

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

Sample Questions

Q1) Which line in the following program contains the prototype showDub function?

1 #include &lt;iostream&gt;

2 using namespace std;

3 void showDub(int);

4 int main()

5 {

6 \(\quad\)int x = 2;

7 \(\quad\)showDub(x);

8 \(\quad\)cout << x << endl;

9 \(\quad\)return 0;

10 }

11 void showDub(int num)

12 {

13 \(\quad\)cout << (num * 2) << endl;

14 }

A) line 3

B) line 4

C) line 7

D) line 11

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

8

Chapter 7: Arrays and Vectors

Available Study Resources on Quizplus for this Chatper

56 Verified Questions

56 Flashcards

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

Sample Questions

Q1) Arrays must be __________ at the time they are __________.

A) sized, executed

B) re-scoped, deleted

C) initialized, declared

D) compiled, typed

E) None of these

Q2) An array with no elements is

A) legal in C++

B) illegal in C++

C) automatically furnished with one element whose value is set to zero

D) automatically furnished with one element, the null terminator

E) None of these

Q3) Assume array1 and array2 are the names of two arrays. To assign the contents of array2 to array1, you would use the following statement: array1 = array2;

A)True

B)False

Q4) C++ limits the number of array dimensions to two.

A)True

B)False

Page 9

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

Chapter 8: Searching and Sorting Arrays

Available Study Resources on Quizplus for this Chatper

30 Verified Questions

30 Flashcards

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

Sample Questions

Q1) The advantage of a linear search is its

A) complexity

B) efficiency

C) simplicity

D) speed

E) None of these

Q2) The following is the pseudocode for which type of algorithm?

For maxElement = each subscript in the array, from the last to the first

For index = 0 To maxElement - 1

If array[index] > array[index + 1]

Swap array[index] with array[index + 1]

End If End For End For

A) bubble sort

B) binary sort

C) bubble search

D) selection sort

E) None of these

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

Chapter 9: Pointers

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

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

Sample Questions

Q1) A pointer can be used as a function argument, giving the function access to the original argument.

A)True B)False

Q2) C++ does not perform array bounds checking, making it possible for you to assign a pointer the address of an element out of the boundaries of an array.

A)True B)False

Q3) Select all that apply. Of the following, which statements have the same meaning?

A) int *ptr = nullptr;

B) int ptr = nullptr;

C) *int ptr = nullptr;

D) int* ptr = nullptr;

E) int ptr* = nullptr;

Q4) With pointer variables you can access but not modify data in other variables. A)True B)False

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

11

Chapter 10: Characters, C-Strings, and More About the String Class

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

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

Sample Questions

Q1) Which of the following defines an array of C-strings that will hold 49 characters and the null terminator?

A) char [49];

B) char str[50];

C) char[50] str;

D) character str[50];

E) None of these

Q2) The __________ function will change a character argument from lowercase to uppercase.

A) isupper

B) toupper

C) tolarge

D) fromlower

E) None of these

Q3) The itoa function is similar to atoi but it works in reverse.

A)True

B)False

Q4) The ftoa function converts a floating-point value to an ASCII value.

A)True

B)False

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

Chapter 11: Structured Data

Available Study Resources on Quizplus for this Chatper

46 Verified Questions

46 Flashcards

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

Sample Questions

Q1) The name of a structure is referred to as its

A) data type

B) argument

C) parameter

D) tag

E) None of these

Q2) If Circle is a structure tag, then the following statement can be the header line for a function that __________. Circle doSomething(Circle c2)

A) determines and returns the area of a circle

B) takes a Circle structure as a parameter, does something, and returns a Circle structure

C) operates on a constant reference to a Circle structure

D) takes two Circle parameters and does something

E) None of these

Q3) Before a structure can be used it must be

A) declared

B) dereferenced

C) initialized

D) All of these

E) None of these

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

Chapter 12: Advanced File Operations

Available Study Resources on Quizplus for this Chatper

38 Verified Questions

38 Flashcards

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

Sample Questions

Q1) When you store data in a variable, it is automatically saved in a file.

A)True

B)False

Q2) All stream objects have __________ which indicate the position of the stream.

A) error state bits

B) condition statements

C) markers

D) intrinsic error messages

E) None of these

Q3) Which of the following means accessing information from a file non-sequentially?

A) linear access

B) incremented acces

C) random access

D) protected access

E) None of these

Q4) If a file already exists, you can open it with the flags ios::in | ios::out to preserve its contents.

A)True B)False

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

Chapter 13: Introduction to Classes

Available Study Resources on Quizplus for this Chatper

54 Verified Questions

54 Flashcards

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

Sample Questions

Q1) Destructor functions are often used to free memory that was allocated by the object.

A)True

B)False

Q2) In a procedural program you typically have __________ stored in a collection of variables and a set of __________ that perform operations on the data.

A) numbers, arguments

B) parameters, arguments

C) strings, operators

D) data, functions

E) None of these

Q3) When an object is defined without an argument list for its constructor, the compiler automatically calls the object's default constructor.

A)True

B)False

Q4) Constructor functions are often used to allocate memory that will be needed by the object.

A)True

B)False

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

Chapter 14: More About Classes

Available Study Resources on Quizplus for this Chatper

46 Verified Questions

46 Flashcards

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

Sample Questions

Q1) It is a good idea to make a copy constructor's parameters __________ by specifying the __________ key word in the parameter list.

A) inline, inline

B) static, static

C) constant, const

D) global, global

E) None of these

Q2) In C++11 an rvalue reference is a reference variable that can refer only to temporary objects.

A)True

B)False

Q3) You can overload the conditional operator to make it function as an unconditional operator.

A)True

B)False

Q4) By default, when an object is assigned to another object, each member of one object is copied to its counterpart in the other object.

A)True

B)False

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

Chapter 15: Inheritance, Polymorphism, and Virtual Functions

Available Study Resources on Quizplus for this Chatper

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) Select all that apply. In an inheritance situation, the new class that you create from an existing class is known as the

A) derived class

B) inheritor

C) child class

D) parental class

E) None of these

Q2) Select all that apply. Which of the following constructors cannot be inherited through constructor inheritance?

A) the default constructor

B) the virtual constructor

C) the move constructor

D) the copy constructor

E) the grand constructor

Q3) In an inheritance situation, you may not pass arguments to a base class constructor.

A)True

B)False

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

Page 17

Chapter 16: Exceptions and Templates

Available Study Resources on Quizplus for this Chatper

36 Verified Questions

36 Flashcards

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

Sample Questions

Q1) When an error occurs, an exception is A) created

B) thrown C) passed

D) ignored

E) None of these

Q2) If an exception is not caught, it is stored for later use.

A)True

B)False

Q3) When the __________ operator fails to allocate memory, C++ throws a bad_alloc exception.

A) new

B) alloc C) catch

D) None of these

Q4) The line containing a throw statement is known as the throw point.

A)True

B)False

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

Page 18

Chapter 17: The Standard Template Library

Available Study Resources on Quizplus for this Chatper

38 Verified Questions

38 Flashcards

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

Sample Questions

Q1) An iterator of the iterator type that gives you read/write access to the element to which the iterator points is known as a(n)

A) immutable iterator

B) mutable iterator

C) auto iterator

D) range iterator

E) None of these

Q2) The difference between the unordered_multimap class and the multimap class is that

A) the unordered_multimap class uses the binary tree data structure for internal storage while the multimap class uses a hash table

B) the multimap class uses the binary tree data structure for internal storage while the unordered_multimap class uses a hash table

C) the keys in the unordered_multimap class are sorted while the keys in the multimap class are in no particular order

D) None of these

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

19

Chapter 18: Linked Lists

Available Study Resources on Quizplus for this Chatper

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) To build a list initally, you can use a(n) __________ routine.

A) build

B) append

C) constructor

D) initialization

E) None of these

Q2) In an insertion or deletion routine:

How many pointers are you required to create for use during the traversal process?

A) two: one for the node under inspection and one for the previous node

B) two: one for the node under inspection and one for the next node

C) one: for the node being inserted or deleted

D) three: one for the node under inspection, one for the next node, and one for the following node

Q3) Select all that apply. A __________ list contains pointers to the nodes before it and after it.

A) multi linked

B) circular linked

C) singly linked

D) doubly linked

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

Page 20

Chapter 19: Stacks and Queues

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

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

Sample Questions

Q1) Select all that apply. Data structures that can dynamically store elements and can grow and shrink in size are

A) stacks

B) arrays

C) queues

D) deques

Q2) For a compiler that is older than C++11 it is necessary to put spaces between the angled brackets that appear next to each other when defining a stack.

A)True

B)False

Q3) When an element is added to a queue, it is added to the rear. When an element is removed from the queue, it is removed from the

A) rear

B) middle

C) front

D) depends on how the programmer writes the code

E) None of these

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

Chapter 20: Recursion

Available Study Resources on Quizplus for this Chatper

27 Verified Questions

27 Flashcards

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

Sample Questions

Q1) A problem can be solved with recursion if it can be broken down into successive smaller problems that are the same as the overall problem.

A)True

B)False

Q2) A recursive function is designed to terminate when it reaches its

A) return statement

B) closing curly brace

C) last parameter

D) base case

E) None of these

Q3) Select all that apply. Which of the following problems can be solved using recursion?

A) computing factorials

B) finding the greatest common divisor of two numbers

C) doing a Binary Search

D) multiplying two numbers

E) traversing a linked list

Q4) In a recursive solution, the base case is always the first case to be called.

A)True

B)False

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

Chapter 21: Binary Trees

Available Study Resources on Quizplus for this Chatper

39 Verified Questions

39 Flashcards

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

Sample Questions

Q1) The shape of a binary tree is

A) always triangular

B) always balanced

C) determined by the programmer

D) determined by the order in which values are inserted

E) None of these

Q2) The PreOrder method of traversing a binary tree involves processing the node's data, traversing the node's left subtree, and then traversing the node's right subtree.

A)True

B)False

Q3) Binary trees can be divided into A) branches

B) leaves

C) subtrees

D) sawdust

E) None of these

Q4) A subtree is an entire branch of a tree from one particular node down.

A)True

B)False

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

Turn static files into dynamic content formats.

Create a flipbook
Problem Solving with C++ Exam Preparation Guide - 949 Verified Questions by Quizplus - Issuu