C++ Programming Exam Preparation Guide - 891 Verified Questions

Page 1


C++ Programming Exam Preparation Guide

Course Introduction

C++ Programming is a foundational course that introduces students to the principles and practices of computer programming using the C++ language. Through a combination of theory and hands-on lab exercises, students learn about fundamental concepts such as variables, data types, control structures, functions, arrays, pointers, and object-oriented programming techniques including classes, inheritance, and polymorphism. The course also covers essential topics like memory management, file operations, and the Standard Template Library (STL). By the end of the course, students will be capable of designing, writing, testing, and debugging C++ programs for a variety of applications, equipping them with skills vital for further studies and careers in software development.

Recommended Textbook

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

Available Study Resources on Quizplus

20 Chapters

891 Verified Questions

891 Flashcards

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

Chapter 1: Introduction to Computers and Programming

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) The preprocessor executes after the compiler.

A)True

B)False

Answer: False

Q2) ________ are used to translate each source code instruction into the appropriate machine language instruction.

A)Modules

B)Library routines

C)Compilers

D)Preprocessor directives

E)None of the above

Answer: C

Q3) During which stage does the central processing unit analyze the instruction and encode it in the form of a number, and then generate an electronic signal?

A)fetch

B)decode

C)execute

D)portability stage

Answer: B

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

Page 3

Chapter 2: Introduction to C Plus Plus

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

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

Sample Questions

Q1) When writing long integer literals or long long integer literals in C++ 11, you can use either an uppercase or lowercase L.

A)True

B)False

Answer: True

Q2) In C++ 11, the ________ tells the compiler to determine the variable's data type from the initialization value.

A)auto key word

B)#include preprocessor directive

C)variable's name

D)dynamic_cast key word

E)None of the above

Answer: A

Q3) Escape sequences are always stored internally as a single character.

A)True

B)False

Answer: True

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

44 Verified Questions

44 Flashcards

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

Sample Questions

Q1) To use the rand()function, you must #include this header file in your program.

A)iostream

B)iomanip

C)iorand

D)cstdlib

E)None of these

Answer: D

Q2) When C++ is working with an operator, it strives to convert the operands to the same type.

A)True

B)False

Answer: True

Q3) 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

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

53 Verified Questions

53 Flashcards

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

Sample Questions

Q1) If you intend to place a block of statements within an if statement, you must place these around the block.

A)Parentheses ( )

B)Square brackets [ ]

C)Angle brackets < >

D)Curly braces { }

E)None of these

Q2) When a relational expression is false, it has the value ________.

A)one

B)zero

C)zero, one, or minus one

D)less than zero

E)None of these

Q3) This operator takes an operand and reverses its truth or falsehood.

A)| |

B)relational

C)arithmetic

D)!

E)None of these

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

63 Verified Questions

63 Flashcards

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

Sample Questions

Q1) Something within a while loop must eventually cause the condition to become false, or a(n)________ results.

A)null value

B)infinite loop

C)unexpected exit

D)compiler error

E)None of these

Q2) If you place a semicolon after the test expression in a while loop, it is assumed to be a(n):

A)pre-test loop

B)post-test loop

C)null statement

D)infinite loop

E)None of these

Q3) A while loop is somewhat limited, because the counter can only be incremented by one each time through the loop.

A)True

B)False

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/30159

Sample Questions

Q1) This is a dummy function that is called instead of the actual function it represents.

A)main function

B)stub

C)driver

D)overloaded function

Q2) In a function header, you must furnish:

A)data type(s)of the parameters

B)data type of the return value

C)the name of function

D)names of parameter variables

E)All of these

Q3) If a function does not have a prototype, default arguments may be specified in the function ________.

A)call

B)header

C)execution

D)return type

E)None of these

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

8

Chapter 7: Arrays

Available Study Resources on Quizplus for this Chatper

58 Verified Questions

58 Flashcards

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

Sample Questions

Q1) If you attempt to store data past an array's boundaries, it is guaranteed that the compiler will issue an error.

A)True

B)False

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

A)True

B)False

Q3) The range-based for loop, in C++ 11, is designed to work with a built-in variable known as the ________.

A)counter variable

B)i variable

C)iterator

D)range variable

E)None of these

Q4) An array initialization list must be placed on one single line. A)True

B)False

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

Chapter 8: Searching and Sorting Arrays

Available Study Resources on Quizplus for this Chatper

20 Verified Questions

20 Flashcards

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

Sample Questions

Q1) Data that is sorted in ascending order is ordered ________.

A)from lowest to highest value

B)from highest to lowest value

C)always with a binary sort algorithm

D)always with a linear sort algorithm

E)None of these

Q2) Before you can perform a bubble sort, the data must be stored in descending order.

A)True

B)False

Q3) Using a linear search to find a value that is stored in the last element of an array of 20,000 elements, ________ element(s)must be compared.

A)20,000

B)only the first

C)only half

D)2000

E)None of these

Q4) The number of comparisons made by a binary search is expressed in powers of two.

A)True

B)False

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

45 Verified Questions

45 Flashcards

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

Sample Questions

Q1) When this is placed in front of a variable name, it returns the address of that variable.

A)asterisk ( * )

B)conditional operator

C)ampersand ( & )

D)semicolon ( ; )

E)None of these

Q2) Not all arithmetic operations may be performed on pointers. For example, you cannot ________ or ________ a pointer.

A)multiply, divide

B)add, subtract

C)+=, -=

D)increment, decrement

E)None of these

Q3) Dynamic memory allocation occurs ________.

A)when a new variable is created by the compiler

B)when a new variable is created at runtime

C)when a pointer fails to dereference the right variable

D)when a pointer is assigned an incorrect address

E)None of these

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

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

Available Study Resources on Quizplus for this Chatper

45 Verified Questions

45 Flashcards

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

Sample Questions

Q1) A library function that can find one C- string inside another is: A)strcmp

B)strstr

C)strfind

D)strsearch

E)None of these

Q2) To use the strlen function in a program, you must also write #include ________.

A)&lt;strlen&gt; B)&lt;iostring&gt; C)&lt;cstring&gt; D)&lt;stringlib&gt; E)None of these

Q3) Although C++ provides ample library functions to handle numeric values, we must write all of our own functions to manipulate character values.

A)True

B)False

Q4) A test using the isupper function will return false if the argument is an uppercase character.

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

53 Verified Questions

53 Flashcards

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

Sample Questions

Q1) This describes only the general characteristics of an object.

A)initialization

B)abstraction

C)detailed specification

D)initiation

E)None of these

Q2) A struct can contain members with varying data types.

A)True

B)False

Q3) If Circle is a structure tag, the statement: Circle dosomething (circle c2) Can be the header line for a function that ________.

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

Q4) An anonymous union declaration actually creates the member variables in memory.

A)True

B)False

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/30146

Sample Questions

Q1) This data type can be used to create files, read data from them, and write data to them.

A)ofstream

B)iftream

C)fstream

D)stream

E)None of these

Q2) The ios::hardfail bit is set when an unrecoverable error occurs.

A)True

B)False

Q3) Only one file stream object can be declared per C++ program.

A)True

B)False

Q4) When passing a file stream object to a function, you should always pass it by reference.

A)True

B)False

Q5) The setprecision manipulator cannot be used to format data written to a file. A)True

B)False

Page 14

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

Chapter 13: Introduction to Classes

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

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

Sample Questions

Q1) Object-oriented programming is centered around the object, which encapsulate together both the data and the functions that operate on the data.

A)True

B)False

Q2) When a member function is defined outside of the class declaration, the function name must be qualified with the ________.

A)class name, followed by a semicolon

B)class name, followed by the scope resolution operator

C)name of the first object

D)private access specifier

E)None of these

Q3) In OOP terminology, an object's member variables are often called its ________, and its member functions are sometimes referred to as its behaviors, or ________.

A)values, morals

B)data, activities

C)attributes, activities

D)attributes, methods

E)None of these

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

15

Chapter 14: More About Classes

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) You may overload any C++ operator, and you may use the operator function to define non-standard operators, such as @ and ^.

A)True

B)False

Q2) If you do not furnish one of these a default will be provided for you by the compiler.

A)copy constructor

B)constructor

C)destructor

D)All of these

E)None of these

Q3) This is a special built-in pointer that is available to a class's member functions.

A)overloaded -> operator

B)this pointer

C)&constructor pointer

D)~destructor *ptr

E)None of these

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) ________ to a base class may be assigned the address of a derived class object.

A)Access specifiers

B)Static members

C)Private members

D)Pointers

E)None of these

Q2) More than one class may be derived from a base class.

A)True

B)False

Q3) ________ is commonly used to extend a class, or to give it additional capabilities.

A)Inheritance

B)Privacy

C)The constructor

D)The destructor

E)None of these

Q4) Static binding occurs when the compiler binds a function call with the function call that resides in the same class as the call itself.

A)True

B)False

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

Chapter 16: Exceptions, Templates, and the Standard

Template Library Stl

Available Study Resources on Quizplus for this Chatper

39 Verified Questions

39 Flashcards

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

Sample Questions

Q1) This is a "generic" function that can work with any data type.

A)function argument

B)function parameter

C)function template

D)member function

E)None of these

Q2) The algorithms provided by the STL are implemented as ________, and perform various operations on elements of containers.

A)virtual functions

B)function templates

C)global variables

D)private data members

E)None of these

Q3) There is no difference between declaring an object of an ordinary class and an object of a template class.

A)True

B)False

Q4) Using a function template requires less code than overloading a function.

A)True

B)False

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) A linked list is called "linked" because each node in the series has a pointer that points to the next node in the list.

A)True

B)False

Q2) The process of moving through a linked list is referred to as ________ the list.

A)cruising

B)traversing

C)node-hopping

D)alternating

E)None of these

Q3) ADT stands for:

A)Algorithm Dependent Template

B)Algorithm Driven Template

C)Abstract Data Type

D)Automatic Data Type

E)None of these

Q4) A new node must always be made the last node in the list.

A)True

B)False

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

Chapter 18: Stacks and Queues

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

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

Sample Questions

Q1) A dynamic stack may be implemented as a(n)________, and expand or shrink with each push or pop operation.

A)array

B)structure

C)linked list

D)A and B

E)None of these

Q2) The ________ operation allows an item to be stored on a stack.

A)append

B)add

C)pop

D)push

E)None of these

Q3) The programmer must declare in advance the size of a dynamic stack or queue.

A)True

B)False

Q4) The first item placed onto a stack is always the last item removed from the stack.

A)True

B)False

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

Chapter 19: Recursion

Available Study Resources on Quizplus for this Chatper

22 Verified Questions

22 Flashcards

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

Sample Questions

Q1) The QuickSort algorithm works on the basis of A)three sublists

B)two sublists and a pivot

C)two pivots and a sublist

D)three pivots

E)None of these

Q2) The QuickSort algorithm was developed in 1960 by ________.

A)Bjarne Stroustrup

B)Tony Gaddis

C)C.A.R. Hoare

D)C.M. Turner

E)None of these

Q3) Indirect recursion means that a function calls itself n number of times, then processing of the function starts from the first call.

A)True

B)False

Q4) A recursive function cannot call another function.

A)True

B)False

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

Chapter 20: Binary Trees

Available Study Resources on Quizplus for this Chatper

38 Verified Questions

38 Flashcards

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

Sample Questions

Q1) Output will be the same if you use inorder, postorder, or preorder traversals of the same binary tree.

A)True

B)False

Q2) The height of a tree describes how many levels there are in the tree.

A)True

B)False

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

A)True

B)False

Q4) 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

Q5) To remove a node that has children, you must first remove the children.

A)True

B)False

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

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.