Applied Programming in C++ Pre-Test Questions - 751 Verified Questions

Page 1


Applied Programming in C++ Pre-Test Questions

Course Introduction

Applied Programming in C++ is a comprehensive course designed to equip students with practical skills in C++ programming, focusing on real-world applications and software development techniques. The course covers fundamental concepts such as variables, data types, control structures, functions, arrays, and pointers, while progressing to more advanced topics like object-oriented programming, inheritance, polymorphism, templates, and the Standard Template Library (STL). Students will engage in hands-on projects and coding exercises to solve complex problems, develop efficient algorithms, and implement robust software solutions. By the end of the course, participants will be proficient in applying C++ principles to design, code, test, and debug programs for a variety of application domains.

Recommended Textbook

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

Available Study Resources on Quizplus 18 Chapters

751 Verified Questions

751 Flashcards

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

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) The basic commands that a computer performs are ____, and performance of arithmetic and logical operations.

A) input, file, list

B) output, folder, storage

C) input, output, storage

D) storage, directory, log

Answer: C

Q2) ____ represent information with a sequence of 0s and 1s.

A) Analog signals

B) Application programs

C) Digital signals

D) System programs

Answer: C

Q3) Several categories of computers exist, such as ____.

A) microframe, midframe, and miniframe

B) midsize, microframe, and mainframe

C) mainsize, midsize, and microsize

D) mainframe, midsize, and micro

Answer: D

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) The smallest individual unit of a program written in any language is called a(n)

Answer: token

Q2) A(n) ____________________ is a memory location whose contents can be changed.

Answer: variable

Q3) The expression static_cast<int>(6.9) + static_cast<int>(7.9) evaluates to

A) 13

B) 14

C) 14.8

D) 15

Answer: A

Q4) An example of a floating point data type is ____.

A) int

B) char

C) double

D) short

Answer: C

Q5) The memory space for a(n) ____________________ data value is 64 bytes. Answer: long long

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) In C++, the dot is an operator called the ____________________operator.

Answer: member access

Q2) Suppose that ch1, ch2, and ch3 are variables of the type char. The input is:

A B C

Choose the value of ch3 after the following statement executes:

Cin >> ch1 >> ch2 >> ch3;

A) 'A'

B) 'B'

C) 'C'

D) '\n'

Answer: C

Q3) In an output statement, each occurrence of endl advances the cursor to the end of the current line on an output device.

A)True

B)False

Answer: False

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 P and Q are logical expressions. The logical expression P && Q is true if both P and Q are true.

A)True

B)False

Q2) The expression (x >= 0 && x <= 100) evaluates to false if either x < 0 or x >= 100.

A)True

B)False

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

A) blocked

B) compound

C) nested

D) closed

Q4) Which of the following is the "not equal to" relational operator?

A) !

B) |

C) !=

D) &

Q5) The ____________________ of relational and logical operators is said to be from left to right.

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) When a continue statement is executed in a ____, the update statement always executes.

A) while loop

B) for loop

C) switch structure

D) do...while loop

Q2) A loop ____________________ is a set of statements that remains true each time the loop body is executed.

Q3) What executes immediately after a continue statement in a while and do-while loop?

A) loop-continue test

B) update statement

C) loop condition

D) the body of the loop

Q4) A semicolon at the end of the for statement (just before the body of the loop) is a(n) ____________________ error.

Q5) The ____________________ statement is typically used for two purposes: To exit early from a loop.

To skip the remainder of a switch structure.

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 Function

Available Study Resources on Quizplus for this Chatper

41 Verified Questions

41 Flashcards

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

Sample Questions

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

A) title

B) function signature

C) function head

D) function header

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) Given the following function prototype: Double tryMe(double, double);

Which of the following statements is valid? Assume that all variables are properly declared.

A) cin >> tryMe(x);

B) cout << tryMe(2.0, 3.0);

C) cout << tryMe(tryMe(double, double), double);

D) cout << tryMe(tryMe(float, float), float);

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

Page 8

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

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) The general syntax for accessing a namespace member is: namespace_name->identifier.

A)True

B)False

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

Q3) The following statement creates an anonymous type: enum {1ST, 2ND, 3RD, 4TH} places;

A)True

B)False

Q4) The ____ function is used to interchange the contents of two string variables.

A) iterator

B) traverse

C) swap

D) change

9

Q5) 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 10

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) All components of an array are of the same data type.

A)True

B)False

Q2) The form of the for loop shown below is called a(n) ____________________ for loop. for (dataType identifier : arrayName) statements

Q3) In a two-dimensional array, the elements are arranged in a table form.

A)True

B)False

Q4) Suppose that gamma is an array of 50 components of type int and j is an int variable. Which of the following for loops sets the index of gamma out of bounds?

A) for (j = 0; j <= 49; j++)

Cout << gamma[j] << " ";

B) for (j = 1; j < 50; j++)

Cout << gamma[j] << " ";

C) for (j = 0; j <= 50; j++)

Cout << gamma[j] << " ";

D) for (j = 0; j <= 48; j++)

Cout << gamma[j] << " ";

Page 11

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

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

Q2) Which of the following is an allowable aggregate operation on a struct?

A) Arithmetic

B) Assignment

C) Input/output

D) Comparison

Q3) Relational operations can be used on struct variables.

A)True

B)False

Q4) A struct is typically a ____ data structure.

A) simple

B) dynamic

C) heterogeneous

D) linked

Q5) Arrays are passed by ____________________ only.

Page 12

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

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) Consider the accompanying class and member functions definitions. How many constructors are present in the class definition?

A) none

B) one

C) two

D) three

Q2) What does ADT stand for?

A) abstract definition type

B) asynchronous data transfer

C) abstract data type

D) alternative definition type

Q3) A class is an example of a structured data type.

A)True

B)False

Q4) In C++ terminology, a class object is the same as a class instance.

A)True

B)False

Q5) A(n) ____________________ function of a class changes the values of the member variable(s) of the class.

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

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

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) ____ is a "has-a" relationship.

A) Inheritance

B) Encapsulation

C) Composition

D) Polymorphism

Q2) Inheritance is an example of a(n) ____ relationship.

A) is-a

B) has-a

C) handshaking

D) had-a

Q3) If the derived class does not override a public member function of the base class, you may specify a call to that public member function by using the name of the function and the appropriate parameter list.

A)True

B)False

Q4) The new classes that we create from existing classes are called ____ classes.

A) sibling

B) base

C) derived

D) parent

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

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) In a ____ copy, two or more pointers of the same type point to the same memory.

A) static

B) shallow

C) dynamic

D) deep

Q2) Variables that are created during program execution are called static variables.

A)True

B)False

Q3) What is the value of x after the following statements execute? int x = 25; Int *p;

P = &x;

*p = 46;

A) nullptr

B) 0

C) 25

D) 46

Q4) The copy constructor automatically executes when, as a parameter, an object is passed by ____________________.

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

Q5) The ____________________ of a base class automatically makes the destructor of a derived class virtual.

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) Which of the following is the syntax to declare the operator function operator[] as a member function of a class for nonconstant arrays?

A) Type& []operator(int index);

B) Type operator[](int index);

C) Type& operator[](int index);

D) Type [](int index);

Q2) The general syntax to overload the stream extraction operator >> for a class is ____.

A) istream& operator>>(istream&, className&); B) const istream& operator>>(istream&, className&);

C) friend operator>>(istream&, className&);

D) friend istream& operator>>(istream&, className&);

Q3) To overload the pre-increment (++) operator for a class, if the operator function is a member of that class, it must have ____ parameter(s).

A) no 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) A(n) ____________________ block specifies the type of exception it can catch and contains an exception handler.

Q2) 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.

Q3) Which of the following statements throws a valid exception in C++?

A) throw.function();

B) throw 2;

C) throws str;

D) 4 throw;

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

Q5) C++ provides all the exception classes you will ever need.

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) Recursive algorithms are implemented using ____________________ functions.

Q2) 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.

Q3) Consider the accompanying definition of a recursive function. What is the output of the following statement? cout << recFunc(8) << endl;

A) 4

B) 8

C) 72

D) 720

Q4) Consider the accompanying definition of a recursive function. Which of the statements represent the general case?

A) Statements in Lines 3-11

B) Statements in Lines 5-6

C) Statements in Lines 5-11

D) Statements in Lines 7-11

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

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) A(n) ____________________ search uses the "divide and conquer" technique to search the list.

Q2) The type vector provides the expression ____________________, which returns true if the object vecList is empty and false otherwise.

Q3) With the binary search algorithm, ____ key comparison(s) is/are made in the successful case-the last time through the loop.

A) one

B) two

C) n-2

D) n

Q4) For a list of length n, insertion sort makes ____ item assignments.

A) n(n-1)/4

B) n(n-1)/2

C) n<sup>2</sup>

D) n<sup>3</sup>

Q5) The type vector provides the expression ____________________, which inserts a copy of elem into vecList at the end.

Q6) The first element in a vector object is at location ____________________.

Q7) 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 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) Consider the statements above. The list is empty if the pointer first is ____.

A) nullptr

B) 0

C) last

D) next

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

Q3) Memory for the components of an array does not need to be contiguous.

A)True

B)False

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

Q5) Which of the following statements appears in the insert function of a doubly linked list?

A) current++;

B) trailCurrent++;

C) newNode++;

D) count++;

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) A(n) ____ is a list of homogenous elements in which the addition and deletion of elements occurs only at one end.

A) stack

B) queue

C) array

D) linked list

Q2) A stack can be implemented as either a(n) ____ or a linked structure.

A) map

B) struct

C) queue

D) array

Q3) When a stack is implemented as an array, the array is empty if the value of stackTop is ____.

A) zero

B) one

C) nonzero

D) equal to the size of the array

Q4) When describing a queuing system, we use the term ____________________ to refer to the time it takes to serve a customer.

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

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.
Applied Programming in C++ Pre-Test Questions - 751 Verified Questions by Quizplus - Issuu