Skip to main content

Programming Fundamentals Final Exam - 949 Verified Questions

Page 1


Programming Fundamentals

Final Exam

Course Introduction

Programming Fundamentals introduces students to the core concepts of computer programming and problem-solving using a high-level programming language. The course covers essential topics such as variables, data types, operators, control structures (selection and iteration), functions, arrays, and basic input/output operations. Emphasis is placed on algorithmic thinking, structured program development, and debugging techniques. Through hands-on coding exercises and projects, students will develop logical reasoning skills and gain practical experience in designing, writing, and testing simple programs, laying a strong foundation for more advanced study in computer science.

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) At the heart of a computer is its central processing unit. The CPU's job is:

A) To fetch instructions

B) To carry out the operations commanded by the instructions

C) To produce some outcome or resultant information

D) All of these

E) None of these

Answer: D

Q2) Machine language is an example of a high-level language.

A)True

B)False

Answer: False

Q3) This is a set of rules that must be followed when constructing a program:

A) syntax

B) punctuation

C) key words

D) operators

E) identifiers

Answer: A

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) Floating point constants are normally stored in memory as doubles.

A)True

B)False

Answer: True

Q2) Programming style refers to the way a programmer uses elements such as identifiers, spaces, and blank lines.

A)True

B)False Answer: True

Q3) What is output of the following statement?

cout << 4 * (15 / (1 + 3)) << endl;

A) 15

B) 12

C) 63

D) 72

E) None of these

Answer: B

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 functions will return the value of x, rounded to the nearest whole number?

A) abs(x)

B) fmod(x)

C) sqrt(x)

D) round(x)

E) whole(x)

Answer: D

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

A) cstdlib

B) cstring

C) iostream

D) cmath

E) iomanip

Answer: D

Q3) The cin << statement will stop reading input when it encounters a newline character.

A)True

B)False

Answer: True

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) As a rule of style, when writing an if statement you should indent the conditionally-executed statements.

A)True

B)False

Q2) Relational operators allow you to __________ numbers.

A) add

B) multiply C) compare D) average

E) None of these

Q3) If the expression on the left side of the following is False, the expression on the right side will not be checked.

(a > = b) && (c == d)

A)True

B)False

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

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) This means to increase a value:

A) decrement

B) increment

C) modulus

D) parse

E) None of these

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) string objects have a member function named c_str that returns the contents of the object formatted as a null-terminated C-string.

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

Sample Questions

Q1) Select all that apply. Which of the following must be included in a function header?

A) the data type of each parameter

B) the data type of the return value

C) the name of the function

D) the names of parameter variables

Q2) Which of the following causes a function to execute?

A) a for loop

B) a do-while loop

C) a function prototype

D) a function call

E) None of these

Q3) A function __________ contains the statements that make up the function.

A) prototype

B) definition

C) call

D) expression

E) parameter list

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) A(n) __________ can be used to specify the starting values of an array.

A) initialization list

B) array name

C) subscript

D) element

E) None of these

Q2) To access an array element, use the array name and the element's ___________.

A) data type

B) subscript

C) value

D) name

E) None of these

Q3) A vector object automatically expands in size to accommodate the items stored in it.

A)True

B)False

Q4) The following statement is a valid C++ definition: double money[25.00];

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) A selection sort and a binary search can be applied to STL vectors as well as arrays.

A)True

B)False

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

A)True

B)False

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

Q4) A binary search begins with the __________ element of an array.

A) first

B) last

C) largest

D) middle

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) If you are using an older computer that does not support the C++11 standard, you should initialize pointers with

A) the integer 0 or the value NULL

B) the null terminator '\0'

C) a nonzero value

D) Any of these

E) None of these

Q2) What will the following code output?

Int number = 22;

Int *var = &number;

Cout << *var << endl;

A) the address of number

B) 22

C) an asterisk followed by 22

D) an asterisk followed by the address of number

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

A)True

B)False

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

47 Verified Questions

47 Flashcards

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

Sample Questions

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

Q2) The string class's front and back member functions were introduced in C++11.

A)True

B)False

Q3) The following string that uses a semicolon as a delimiter contains four tokens: "apple;cherry;lemon cream"

A)True

B)False

Q4) You may use the <, >, <=, >=, ==, and != relational operators to compare string objects.

A)True

B)False

Q5) The isdigit function will return true if the argument is a digit between 0 and 9. A)True

B)False

12

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

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 expression *s->p; indicates that s is a structure pointer and p, which is also a pointer, is a member of the structure pointed to by s.

A)True

B)False

Q2) Given the structure definition shown, assume that circle1 and circle2 are variables of the Circle type and their members have been initialized. struct Circle {

\(\quad\)double centerX; \(\quad\)double centerY; \(\quad\)double radius; };

Then, is it true or False that the following statement correctly determines whether the two variables' members contain the same data? if (circle1 == circle2)

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

Sample Questions

Q1) Which of the following is the state bit that is set when an attempted operation fails?

A) ios::failbit

B) ios::badbit

C) ios::hardfail

D) ios::goodbit

E) None of these

Q2) Which of the following statements opens a file named info.txt for both input and output?

A) dataFile.open("info.txt", ios::in && ios::out);

B) dataFile.open("info.txt", ios::in, ios::out);

C) dataFile.open("info.txt", input || output);

D) dataFile.open("info.txt", ios::in | ios::out);

E) None of these

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

A)True

B)False

Q4) File output may be formatted the same way as console screen output.

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) A __________ is a member function that is automatically called when a class object is __________.

A) constructor, created

B) destructor, created

C) static function, deallocated

D) utility function, declared

E) None of these

Q2) The destructor function's return type is

A) int

B) float

C) char

D) Nothing; destructors have no return type

E) None of these

Q3) The constructor function always has the same name as A) the first private data member

B) the first public data member

C) the class

D) the first object of the class

E) None of these

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) If a member is declared __________, all objects of that class have access to that variable.

A) static

B) dynamic

C) inline

D) default

E) None of these

Q2) The overloaded = operator copies data from one object to another so it is known as the overload copy operator.

A)True

B)False

Q3) In C++ if you overload the < operator, you must also overload the > operator.

A)True

B)False

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

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) Protected members of a base class are like __________, but they may be accessed by derived classes.

A) constructor functions

B) static members

C) private members

D) public members

E) None of these

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

A)True

B)False

Q3) What is being protected in the following statement?

Class Car :

Protected Vehicle

A) derived class functions

B) base class members

C) derived class data

D) future inherited classes

E) None of these

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) Using a function template requires less code than overloading a function.

A)True

B)False

Q2) Catch blocks serve as

A) exception handlers

B) receivers

C) temporary variables

D) permanent storage for trapped errors

E) None of these

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) A generic function that can work with any data type is called an exception template.

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) Which of the following defines an array object that holds three strings?

A) array&lt;int, 3&gt; items = {blue, green, yellow}

B) array&lt;strings, 4&gt; items = {'blue', 'green', 'yellow',}

C) array&lt;string, 4&gt; items = {"blue", "green", "yellow"}

D) array&lt;4&gt; string items {"blue", "green", "yellow"}

E) None of these

Q2) Two types of container classes in the STL are

A) sequence and associative

B) box and cylinder

C) array and struct

D) constant and literal

E) None of these

Q3) When an element is stored in a map, it is stored as an object of the __________ type.

A) map

B) key

C) pair

D) key_value

E) None of these

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

Page 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) A linked list is a series of connected

A) ADTs

B) vectors

C) algorithms

D) nodes

E) None of these

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

Q4) Linked lists are less complex to code and manage than arrays.

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) In a static stack class, the constructor function can dynamically allocate memory for the stack array.

A)True

B)False

Q2) Given the following code, assume the myStack object is a stack that can hold integers and that value is an int variable. 1 myStack.push(0);

2 myStack.push(1);

3 myStack.push(2);

4 myStack.pop(value);

5 myStack.pop(value);

6 myStack.pop(value);

7 cout << value << endl;

Assume that the pop function, called on lines 4, 5, and 6, stores the number popped from the stack in the value variable. What will the statement on line 7 display?

A) 0

B) 1

C) 2

D) None of these

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) The programmer must ensure that a recursive function does not become

A) a static function

B) a virtual function

C) an endless loop

D) a dynamic function

E) None of these

Q2) The recursive factorial function calculates the factorial of its parameter. Its base case is when the parameter is

A) returned

B) received

C) one

D) zero

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

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) A binary tree with a height of three has A) six nodes

B) one root and three nodes with two children each

C) three levels

D) three subtrees

E) None of these

Q2) In a binary tree class you usually have a pointer as a member that is set to the A) leftmost child node

B) first leaf node

C) root of the tree

D) deepest leaf node

E) None of these

Q3) The InOrder, PreOrder, and PostOrder traversals can be accomplished using A) recursion

B) no pointers

C) no arguments

D) no parameters

E) None of these

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

23

Turn static files into dynamic content formats.

Create a flipbook
Programming Fundamentals Final Exam - 949 Verified Questions by Quizplus - Issuu