Skip to main content

Programming Fundamentals Practice Exam - 766 Verified Questions

Page 1


Programming Fundamentals

Practice Exam

Course Introduction

Programming Fundamentals introduces the essential concepts and techniques of computer programming using a high-level programming language. Students will learn foundational skills such as algorithm development, problem-solving strategies, data types, control structures (sequence, selection, and repetition), functions, arrays, and basic input/output operations. The course emphasizes logical thinking, debugging, and code documentation, providing students with practical experience through hands-on exercises and projects. By the end of the course, learners will be equipped with the fundamental understanding necessary to write simple programs and to pursue more advanced topics in computer science.

Recommended Textbook

Starting out with C++ Early Objects 9th Edition by Tony Gaddis

Available Study Resources on Quizplus

19 Chapters

766 Verified Questions

766 Flashcards

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

Chapter 1: Introduction to Computers and Programming

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) The term hardware refers to

A) the difficulty of programming.

B) the physical components that make up a computer.

C) the way a computer's storage space is organized.

D) the fixed order of a program's instructions.

E) none of the above.

Answer: B

Q2) A software package that includes a text editor, compiler, debugger, and assorted utilities for creating, testing, and running software is called

A) a low-level programming language.

B) a high-level programming language.

C) a software utility package (SUP).

D) an operating system.

E) none of the above.

Answer: E

Q3) If a new value is stored in a variable, it replaces whatever value was previously there. A)True

B)False

Answer: True

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) The following two statements both assign the value 5 to the variable dept. 5 = dept; dept = 5;

A)True

B)False

Answer: False

Q2) Which of the following is/are valid C++ identifiers?

A) department_9

B) aVeryLongVariableName

C) last-name

D) All of the above.

E) Both A and B, but not C.

Answer: E

Q3) If a variable is defined as int sum;

it may be written in the program code as sum or Sum, but not SUM.

A)True

B)False

Answer: False

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) When the final value of an expression is assigned to a variable, it will be converted to A) the smallest possible data type.

B) the largest possible data type.

C) the data type of the variable.

D) the data type of the expression.

E) none of the above.

Answer: C

Q2) The following two statements will assign the same value to result. result = a + b * c; result = b * c + a;

A)True

B)False

Answer: True

Q3) The following statement sets sum1, sum2, and sum3 all to zero. sum1 = sum2 = sum3 = 0; 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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) In C++ when a relational expression is false, it has the value

A) 1.

B) 0.

C) -1.

D) "0".

E) of any negative number.

Q2) The following C++ test checks if the variable child is in the range 3 to 12. if (child >= 3 || child <= 12)

A)True

B)False

Q3) The default section of a switch statement performs a similar task as the ________ portion of an if/else if statement.

A) conditional test

B) break

C) trailing else

D) else if

E) body

Q4) All of the relational operators are binary.

A)True

B)False

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

Chapter 5: Looping

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) The ++ operator

A) is a unary operator.

B) adds one to the value of its operand.

C) can operate in prefix or postfix mode.

D) All of the above.

E) Both B and C, but not A.

Q2) To ________ a value means to increase it.

A) decrement

B) increment

C) add up

D) accumulate

E) total

Q3) When a loop is nested inside another loop, the inner loop goes through all its iterations for each iteration of the outer loop.

A)True

B)False

Q4) A while loop is somewhat limited, because the counter can only count up, not down.

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) A static local variable is one

A) whose value never changes.

B) whose value is retained between function calls.

C) with the same name as a global variable.

D) whose scope is limited to the function it is defined in.

E) that is reinitialized each time the function it is defined in is called.

Q2) In a function call, in addition to the name of the function, you are required to furnish

A) a data type for each argument.

B) an identifier name or constant for each argument.

C) the data type of the return value.

D) All of the above

E) A, and B, but not C.

Q3) A function ________ is a statement that causes a function to execute.

A) prototype

B) header

C) definition

D) call

E) parameter list

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

8

Chapter 7: Introduction to Classes and Objects

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) In C++ and other object-oriented programming languages, ADTs are normally implemented as classes.

A)True

B)False

Q2) An object is a(n) ________ of a class.

A) example

B) copy

C) instance

D) attribute

E) member

Q3) An object typically hides its data, but allows outside code to access it through its A) private member functions.

B) public member functions.

C) public data members.

D) access specifiers.

E) None of the above

Q4) ADT stands for Algorithmic Data Type.

A)True

B)False

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

Chapter 8: Arrays

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) If a C++ program contains the following array definition int score[10];

the following statement would store 100 in the first array element: score[1] = 100;

A)True

B)False

Q2) Subscript numbering in C++

A) can be set at run time.

B) can begin with a programmer-defined value.

C) varies from program to program.

D) automatically begins with zero.

E) automatically begins with one.

Q3) Which of the following statements will correctly carry out the operation stated in the comment to its right.

A) array 2 = array1 // Copy the elements of array 1 into array 2.

B) cout << array2 // Output the elements stored in array 2.

C) array2 = 5; // Place a 5 in each element of array2.

D) None of the above.

E) A and B, but not C.

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

Page 10

Chapter 9: Searching, Sorting, Algorithm Analysis

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) To find a value in an ordered array of 50 items, how many values must binary search examine at most.

A) 1

B) 6

C) 10

D) 25

E) 50

Q2) If a binary search is used to search for the number 4 in the 11-element array shown here int A[] = {1, 2, 3, 4, 6, 7, 8, 9, 10, 12, 17};

Which value will the 4 be compared to first?

A) 1

B) 7

C) 8

D) 9

E) 17

Q3) Bubble sort and selection sort can also be used with STL vectors.

A)True

B)False

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

11

Chapter 10: Pointers

Available Study Resources on Quizplus for this Chatper

62 Verified Questions

62 Flashcards

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

Sample Questions

Q1) You may use the type pointer to a structure as the type of a A) function parameter.

B) structure member.

C) function return type.

D) All of the above

E) None of the above

Q2) The expression *s->p; is only meaningful if s is a pointer to a structure and p is a pointer that is a member of that structure.

A)True

B)False

Q3) A pointer variable is designed to store

A) any legal C++ value.

B) only floating-point values.

C) a memory address.

D) an integer.

E) None of the above

Q4) C++ does not perform array bounds checking.

A)True

B)False

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

Chapter 11: More About Classes and Object-Oriented Programming

Available Study Resources on Quizplus for this Chatper

70 Verified Questions

70 Flashcards

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

Sample Questions

Q1) To overload the + operator, you would write a function called

A) overload +.

B) operator +.

C) function +.

D) operator.overload(+).

E) None of the above

Q2) A(n) ________ is a special function that is called whenever a new object is created and initialized with data from another object of the same class.

A) destructor

B) static function

C) copy constructor

D) assignment function

E) None of the above

Q3) It is possible to declare an entire class as a friend of another class.

A)True

B)False

Q4) In an inheritance situation, you can't 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 13

Chapter 12: More on C-Strings and the String Class

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) It is possible to implement a string class by using a dynamically allocated array of characters.

A)True

B)False

Q2) The string class append member function str.append(s)tacks a string s to the end of str.

A)True

B)False

Q3) After num = stoi("1000"); executes, what value is stored in the variable num?

A) 1000

B) 999 (1000 minus 1 for the null terminator)

C) "1000"

D) "thousand"

E) None of the above

Q4) A good way to convert a value of type double to a string is

A) use the ostringstream class.

B) use the strtodouble function.

C) use the doubletoa function.

D) use the doublestringstream class.

E) None of the above

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

Chapter 13: Advanced File and Io Operations

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

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

A)True

B)False

Q2) The read and write member functions of fstream objects can only work with buffers specified by pointers to char.

A)True

B)False

Q3) string objects cannot be stored to a binary file without further processing because they contain pointers.

A)True

B)False

Q4) The stream member function fail() can be used to determine whether the last operation performed on a stream was successful.

A)True

B)False

Q5) To write to a binary file, you can use the write() member function of an ofstream object.

A)True

B)False

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

Chapter 14: Recursion

Available Study Resources on Quizplus for this Chatper

20 Verified Questions

20 Flashcards

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

Sample Questions

Q1) The ________ of recursion is the number of times a recursive function calls itself.

A) level

B) breadth

C) type

D) depth

E) None of the above

Q2) A ________ function is one that calls itself.

A) dynamic

B) static

C) recursive

D) data validation

E) None of the above

Q3) The QuickSort algorithm was developed in 1960 by

A) Bjarne Stroustrup.

B) Tony Gaddis.

C) C.A.R. Hoare.

D) Judy Walters.

E) None of the above

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

Chapter 15: Polymorphism and Virtual Functions

Available Study Resources on Quizplus for this Chatper

22 Verified Questions

22 Flashcards

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

Sample Questions

Q1) A virtual function is declared by placing the keyword ________ in front of the return type in the base class's function declaration.

A) virtual

B) private

C) public

D) protected

E) None of the above

Q2) Static binding occurs when the compiler binds a function call at compile time.

A)True

B)False

Q3) When more than one class is derived from a base class, the situation is called A) polymorphism.

B) population.

C) multiplicity.

D) encapsulation.

E) None of the above

Q4) In C++ polymorphism is very difficult to achieve unless you also use inheritance.

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

40 Verified Questions

40 Flashcards

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

Sample Questions

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

Q2) There is no difference between defining an object of an ordinary class and an object of a template class.

A)True

B)False

Q3) The bad_alloc exception is thrown

A) when program code encounters a bad memory location.

B) by the new operator.

C) when you forget to free memory with the delete operator.

D) only when the program contains a catch block.

E) None of the above

Q4) Non-template functions have a slight advantage in speed over template functions.

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

38 Verified Questions

38 Flashcards

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

Sample Questions

Q1) When using a node pointer to traverse a linked list, we know we have reached the end of a list when

A) we encounter the new line character '\n'.

B) we encounter a successor pointer value of NULL in the current node.

C) we arrive back at the beginning of the list.

D) we encounter a sentinel, usually 9999.

E) None of the above

Q2) A ________ is used to step through a linked list and search for data.

A) node

B) pointer

C) NULL value

D) traversal operator

E) None of the above

Q3) The successor pointer in the last node of a linked list should have its value set to A) NULL .

B) the address of the previous node.

C) the address of the first node in the list.

D) nothing: the last node has no successor pointer.

E) None of the above

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

36 Verified Questions

36 Flashcards

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

Sample Questions

Q1) For most people, ________ queues are more intuitive and easier to understand than ________ queues.

A) Static, dynamic

B) Dynamic, static

C) Deque-like, stack-like

D) Stack-like, deque-like

E) None of the above

Q2) Push and pop are the two most common queue operations.

A)True

B)False

Q3) If information is transmitted faster than it can be processed, it can be held in a ________ while it awaits processing.

A) stack

B) queue

C) static array

D) static deque

E) None of the above

Q4) A dynamic stack starts as an empty linked list.

A)True

B)False

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

Chapter 19: Binary Trees

Available Study Resources on Quizplus for this Chatper

38 Verified Questions

38 Flashcards

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

Sample Questions

Q1) When an application begins searching a binary search tree, it starts at A) the outermost leaf node.

B) the middle node, halfway between the root and the longest branch.

C) the root node.

D) the rightmost child of the root node.

E) None of the above

Q2) Deleting a node from a binary search tree node

A) is easiest when the node is the root.

B) is hardest when the node is a leaf.

C) is hardest when the node has one child.

D) is hardest when the node has two children.

E) None of the above

Q3) A program keeps track of a binary tree using a pointer to A) one of its leaves.

B) its root node.

C) the node in the tree holding the biggest value.

D) the node in the tree holding the smallest value.

E) None of the above

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

21

Turn static files into dynamic content formats.

Create a flipbook