

Programming Fundamentals
Mock Exam
Course Introduction
Programming Fundamentals introduces students to the essential concepts and practices of computer programming. Through hands-on exercises and projects, students learn about algorithms, logic, problem-solving strategies, and the syntax and semantics of a modern programming language. Key topics include data types, variables, control structures, functions, arrays, and the principles of structured and object-oriented programming. This course builds a foundation for further study in computer science and equips students with the skills necessary to design, write, and debug simple computer programs.
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

Page 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) 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
Answer: B
Q2) Mistakes that cause a running program to produce incorrect results are called:
A) syntax errors
B) logic errors
C) compiler errors
D) linker errors
E) None of these
Answer: B
Q3) The preprocessor executes after the compiler.
A)True
B)False
Answer: False
To view all questions and flashcards with answers, click on the resource link above. Page 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) In a cout statement, which of the following will advance the output position to the beginning of the next line?
A) endl or \n
B) end1 or /n
C) \n or \t
D) \t or \b
E) \\ or \'
Answer: A
Q2) Every complete C++ program must have a
A) comment
B) function named main
C) symbolic constant
D) cout statement
E) None of these
Answer: B
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.
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) Which of the following statements will pause the screen until the [Enter] key is pressed?
A) cin;
B) cin.getline();
C) cin.get();
D) cin.ignore();
E) cin.input();
Answer: C
Q2) What is true about the following statement?
cout << setw(4) << num4 << " ";
A) It allows four spaces for the value in num4.
B) It outputs "setw(4)" before the value in num4.
C) It is incorrect because it should use setw(10).
D) It is incorrect because it should use setw(num4).
Answer: A
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
51 Verified Questions
51 Flashcards
Source URL: https://quizplus.com/quiz/27274
Sample Questions
Q1) Relational operators allow you to __________ numbers.
A) add
B) multiply
C) compare
D) average
E) None of these
Q2) What is the value of the following expression?
True && False
A) true
B) False
C) -1
D) +1
E) None of these
Q3) As a rule of style, when writing an if statement you should indent the conditionally-executed statements.
A)True
B)False
Q4) The conditional operator takes two operands.
A)True
B)False

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

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) An initialization expression may be omitted from the for loop if no initialization is required.
A)True
B)False
Q2) What will the following code display?
Int number = 6;
Int x = 0;
X = --number;
Cout << x << endl;
A) 6
B) 5
C) 7
D) 0
Q3) What will the following code display?
Int number = 6;
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) A parameter is a special purpose variable that is declared inside the parentheses of a function definition.
A)True
B)False
Q2) A function _________ eliminates the need to place a function definition before all calls to the function.
A) header
B) prototype
C) argument
D) parameter
E) None of these
Q3) Global variables are initialized to zero by default.
A)True
B)False
Q4) When a function is called, flow of control moves to the function's prototype.
A)True
B)False
Q5) Local variables are initialized to zero by default.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 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) Each individual element of an array can be accessed by the array name and the element subscript.
A)True
B)False
Q2) A vector object automatically expands in size to accommodate the items stored in it.
A)True
B)False
Q3) This vector function is used to insert an item into a vector.
A) insert_item
B) add_item
C) store
D) push_back
Q4) When you pass an array as an argument to a function, the function can modify the contents of the array.
A)True
B)False
Q5) An array initialization must be all on one 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
30 Verified Questions
30 Flashcards
Source URL: https://quizplus.com/quiz/27278
Sample Questions
Q1) A selection sort and a binary search can be applied to STL vectors as well as arrays.
A)True
B)False
Q2) A linear search can only be implemented with integer values.
A)True
B)False
Q3) A binary search begins with the __________ element of an array.
A) first
B) last
C) largest
D) middle
E) None of these
Q4) The bubble sort is an easy way to arrange data in ascending order but it cannot arrange data in descending order.
A)True
B)False
Q5) 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
47 Verified Questions
47 Flashcards
Source URL: https://quizplus.com/quiz/27279
Sample Questions
Q1) 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
Q2) Assuming myValues is an array of int values and index is an int variable, both of the following statements do the same thing.
1. cout << myValues[index] << endl;
2. cout << *(myValues + index) << endl;
A)True
B)False
Q3) With pointer variables you can access but not modify data in other variables.
A)True
B)False
Q4) A pointer can be used as a function argument, giving the function access to the original argument.
A)True
B)False

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

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) The arguments of the strcpy function are
A) two C-strings
B) two addresses
C) three pointers
D) one array and one pointer
E) None of these
Q2) The string class's front and back member functions were introduced in C++11.
A)True
B)False
Q3) 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
Q4) By being able to pass arrays as arguments, you can write your own functions for processing C-strings.
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) Before a structure can be used it must be
A) declared
B) dereferenced
C) initialized
D) All of these
E) None of these
Q2) When a programmer creates an abstract data type, he or she can decide what values are acceptable for the data type, as well as what operations may be performed on the data type.
A)True
B)False
Q3) After the following statement executes, what value will the MAPLE enumerator be stored as, in memory?
Enum Tree { OAK, MAPLE, PINE };
A) "MAPLE"
B) 2
C) 'M'
D) 1
E)1.0
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) Which of the following data types can be used to create files and read information from them into memory?
A) ofstream
B) istream
C) ifstream
D) instream
E) None of these
Q2) The __________ marker is the character that marks the end of a file and is automatically written when the file is closed.
A) End Of File (EOF)
B) No More Data (NMD)
C) Data Stream Close (DSC)
D) Data Read Stop (DRS)
E) None of these
Q3) ofstream, ifstream, and fstream are
A) header files
B) libraries
C) data types
D) string arrays
E) None of these
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) The type of member function that may be called from a statement outside the class is
A) public
B) private
C) undeclared
D) global
E) None of these
Q2) If you do not declare an access specification, the default for members of a class is
A) inline
B) private
C) public
D) global
E) None of these
Q3) More than one constructor function may be defined for a class.
A)True
B)False
Q4) A destructor function can have zero to many parameters.
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) A member function that is declared __________ may not access any non-static data members in the class.
A) private
B) public
C) static
D) inline
E) None of these
Q2) 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
Q3) In C++11 an rvalue reference is a reference variable that can refer only to temporary objects.
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) Which is the derived class in the following statement?
Class Car :
Protected Vehicle
A) Car
B) Vehicle
C) protected
D) There is no way to tell.
E) None of these
Q2) The __________ destructor is called before the __________ destructor.
A) base, derived
B) derived, base
C) public, private
D) private, public
E) None of these
Q3) The __________ constructor is called before the __________ constructor. A) base, derived
B) derived, base
C) public, private
D) private, public
E) None of these

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

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) A generic function that can work with any data type is called an exception template.
A)True
B)False
Q2) Which of the following is used to signal errors or unexpected results that happen as a program runs?
A) virtual functions
B) destructors
C) exceptions
D) templates
E) None of these
Q3) What does the T represent in the following statement?
Template < class T >
A) the name of the function template
B) T stands for Template
C) a generic data type that is used in a function template
D) the int data type
E) None of these
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) The most important data structures in the STL are __________
A) arrays and structures
B) lists and groups
C) containers and iterators
D) templates and prototypes
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
Q3) A function object is an object that acts like a function and is also known as a functor.
A)True
B)False
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) When working with a linked list one of the basic operations you can perform is to destroy the list.
A)True
B)False
Q2) A linked list class must take care of removing the dynamically allocated nodes and this is done by
A) the constructor function
B) the destructor function
C) overriding the removal function
D) overloading the memory persistence operator
E) None of these
Q3) To delete an entire list, normally you must traverse the list, deleting each node, one by one.
A)True
B)False
Q4) A list that contains pointers to the previous node, the next node, and a node in the third dimension is known as a triple linked list.
A)True
B)False
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) Given the following code, assume the myQueue object is a queue that can hold integers and that value is an int variable. 1 myQueue.enqueue(0);
2 myQueue.enqueue(1);
3 myQueue.enqueue(2);
4 myQueue.dequeue(value);
5 myQueue.dequeue(value);
6 myQueue.dequeue(value);
7 cout << value << endl;
Assume that the dequeue function, called on lines 4, 5, and 6, stores the number removed from the queue in the value variable. What will the statement on line 7 display?
A) 0
B) 1
C) 2
D) None of these
Q2) In a static stack class, the constructor function can dynamically allocate memory for the stack array.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above.

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 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
Q2) The __________ of recursion is the number of times a recursive function calls itself.
A) level
B) breadth
C) type
D) depth
E) None of these
Q3) A recursive function cannot call another function.
A)True
B)False
Q4) To solve a problem recursively, you must identify at least one case in which the problem can be solved without recursion.
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) When a binary tree is used to facilitate a search, it is referred to as a
A) binary queue
B) binary ordered deque
C) sort algorithm
D) binary search tree
E) None of these
Q2) Output will be the same if you use InOrder, PostOrder, or PreOrder traversals of the same binary tree.
A)True
B)False
Q3) The InOrder method of traversing a binary tree involves traversing the node's left subtree, processing the node's data, and then traversing the node's right subtree.
A)True
B)False
Q4) The width of a tree is the largest number of nodes in the same level.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above.

23