Skip to main content

Programming Fundamentals Exam Preparation Guide - 766 Verified Questions

Page 1


Programming Fundamentals

Exam Preparation Guide

Course Introduction

Programming Fundamentals introduces students to the essential concepts of computer programming and problem solving using a high-level programming language. The course covers foundational topics such as variables, data types, operators, control structures (conditional statements and loops), functions, basic data structures (arrays and lists), and input/output operations. Emphasis is placed on developing logical thinking and algorithmic approaches to solve problems efficiently. Through hands-on assignments and projects, students gain practical experience in writing, testing, and debugging code, preparing them for more advanced studies in computer science and software development.

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) At the heart of a computer is its central processing unit (CPU). Its job is to A) fetch instructions.

B) carry out the operations commanded by the instructions.

C) produce some result.

D) do all of the above.

E) do none of the above.

Answer: D

Q2) In the C++ statement pay = rate * hours; The * symbol is an example of A) an operator.

B) an operand.

C) a variable separator.

D) syntax.

E) none of the above.

Answer: A

Q3) Before a computer can execute a program written in a high level language, such as C++, it must be translated into object code.

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) Which of the following is/are valid C++ identifiers?

A) June-2010

B) June.2010

C) June_2010

D) 2010June

E) Both C and D.

Answer: C

Q2) You must have a(n) ________ for every variable you include in a program.

A) purpose

B) definition

C) comment

D) numeric value

E) output statement

Answer: B

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) The ________ stream manipulator can be used to establish a field width for the value immediately following it.

A) cin

B) setField

C) setw

D) iomanip

E) width

Answer: C

Q2) Hand tracing a program is

A) a program design technique.

B) a program run-time testing technique.

C) a program debugging technique.

D) creating a drawing of what a program's output screen will look like.

E) none of the above.

Answer: C

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) When a program lets the user know that an invalid menu choice has been made, this is an example of

A) input validation.

B) output validation.

C) menu reselection.

D) invalidation.

E) being user unfriendly.

Q2) When an if statement is placed within the conditionally-executed code of another if statement, this is known as a(n)

A) complex if

B) overloaded if C) nested if

D) conditional if E) double if

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

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

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) If a while loop has no braces around the body of the loop

A) there is no loop body.

B) the loop body ends when the endwhile statement is encountered.

C) the loop body contains just one statement.

D) the program will not compile.

E) the program will compile, but not run.

Q2) A variable that keeps a running total of data values is called a(n)

A) total.

B) sum.

C) accumulator.

D) counter.

E) loop control variable.

Q3) A while loop is somewhat limited because the counter can only be incremented or decremented by one each time through the 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) In C++ global and local numeric variables are initialized to zero by default.

A)True

B)False

Q2) A function ________ eliminates the need to place the function definition before all calls to the function.

A) header

B) prototype

C) argument

D) parameter

E) that is void

Q3) A(n) ________ argument is one that is automatically passed to a parameter when the argument is left out of the function call.

A) floating-point

B) actual

C) null

D) default

E) static

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

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

Q2) A constructor may have a return type of

A) int

B) bool

C) void

D) any of the above.

E) none of the above.

Q3) Public members of a class object can be accessed from outside the class by using the

A) dot operator.

B) get function.

C) extraction operator.

D) member access operator.

E) class name.

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) An individual array element can be processed or passed to a function just like a regular C++ variable.

A)True

B)False

Q2) If employee is an array of objects with a public member function named setHoursWorked, which of the following statements correctly calls that function for the employee object in array element 5?

A) employee.setHoursWorked[5] = 40;

B) employee[5].setHoursWorked = 40;

C) employee.setHoursWorked[5](40);

D) employee[5].setHoursWorked(40);

E) setHoursWorked(employee[5], 40);

Q3) The following statement for(int val : myArray)

Cout << val << " "; Is an example of a(n)

A) regular for loop.

B) range-based for loop.

C) nested for loop.

D) infinite for loop.

E) illegal statement.

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) A(n) ________ search is more efficient than a(n) ________ search.

A) string, double B) integer, double C) binary, linear D) linear, binary

E) None of the above. All searches are equally efficient.

Q2) A sorting algorithm can be used to arrange a set of ________ in ________ order. A) numeric values, ascending B) numeric values, descending C) strings, ascending D) strings, descending E) All of the above.

Q3) When searching for a particular object in an array of objects, it is necessary to compare the search key to the value in each examined object's key field.

A)True

B)False

Q4) A binary search requires that the elements be in order.

A)True B)False

To view all questions and flashcards with answers, click on the resource link above. Page 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) An array name is a pointer constant because the address it represents cannot be changed during run-time.

A)True

B)False

Q2) When you work with a dereferenced pointer, you are actually working with

A) a variable whose memory has been deallocated.

B) a copy of the value pointed to by the pointer variable.

C) the variable whose address is stored in the pointer variable.

D) All of the above

E) None of the above

Q3) The statement int *ptr = new int; acquires memory to hold an integer and then

A) initializes the allocated memory to 0.

B) assigns an integer value to the variable called ptr.

C) sets ptr to point to the allocated memory.

D) creates a new pointer called int.

E) None of the above

Q4) The expression s->m is meaningful only when s is a pointer to a structure and m is a member of the structure.

A)True

B)False

Page 12

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

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) When overloading the operator ++, ________ is used to distinguish preincrement from postincrement.

A) a parameterless data type

B) the keyword void

C) a dummy integer parameter

D) the placeholder [ ]

E) None of the above

Q2) A situation in which every object of a class A has a pointer to an object of a class B, and the objects of the class B may outlive objects of class A, is called

A) a has-A relation.

B) aggregation.

C) composition.

D) an is=A relation.

E) None of the above

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

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) To account for the null terminator stored at the end of each C-string, the strlen function returns the number of characters in its argument, plus one.

A)True

B)False

Q2) Assume that str1 and str2 are objects of the string class. The proper expression to use when comparing them for equality is

A) str1 = str2.

B) str1 == str2.

C) strcmp(str1, str2).

D) str1.compare(str2).

E) None of the above

Q3) An array of characters ending with the null terminator is called

A) a C-string.

B) a C++ String.

C) a string literal.

D) a string class object.

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) Which statement opens a file and links it to a file stream object?

A) open(AFile) = link(anObject);

B) file.open("filename.txt");

C) linkstream("filename.txt");

D) link(open(filename.txt"));

E) None of the above

Q2) The ________ member function reports when the end of a file has been found.

A) end()

B) stop()

C) done()

D) eof()

E) None of the above

Q3) The ________ may be used to read information from a file.

A) cout object

B) the stream insertion operator

C) file.in macro

D) stream extraction operator

E) None of the above

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

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) Any algorithm that can be coded with recursion can also be coded using a loop.

A)True

B)False

Q3) The ________ algorithm uses recursion to sort an array.

A) shell sort

B) quicksort

C) binary sort

D) red/black sort

E) None of the above

Q4) When a recursive function directly calls itself, this is known as direct recursion.

A)True

B)False

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) In C++ polymorphism is very difficult to achieve unless you also use inheritance.

A)True

B)False

Q2) In C++, polymorphism is based on the ability to make member functions of a class

A) static.

B) protected.

C) virtual.

D) encapsulated.

E) None of the above

Q3) When the compiler binds a call to a member function using only information available at compile time, the compiler is said to use ________ binding.

A) local

B) safe

C) static

D) dynamic

E) None of the above

Q4) Pointers to a base class may be assigned the address of a derived class object.

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) A sequential container organizes data in a sequential fashion, similar to an array or linked list.

A)True

B)False

Q2) Iterators are objects that are similar to pointers.

A)True

B)False

Q3) Using a function template often requires writing less code than overloading a function.

A)True

B)False

Q4) A(n)________ is a class that stores data and organizes it in some fashion.

A) iterator

B) container

C) template

D) box

E) None of the above

Q5) An exception is a condition that can be caused by a syntax error in the program. 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 you delete a node from a linked list, you must ensure that the links in the surrounding nodes are set to bypass the node being deleted.

A)True

B)False

Q2) The values stored in the value portion of a node of a linked list can be simple data types, structures, objects of classes, or any other data type.

A)True

B)False

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

Q4) Nodes in a linked list are stored in contiguous memory. 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

36 Verified Questions

36 Flashcards

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

Sample Questions

Q1) The ________ operation allows an item to be removed from a stack.

A) push

B) pop

C) delete

D) remove

E) None of the above

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

A)True

B)False

Q3) Enqueue and dequeue are the two most common stack operations.

A)True

B)False

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

B)False

Q5) A real-world example of the queue data structure can be seen in a stack of cafeteria trays, where the last tray pushed onto the stack is the first tray removed. 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) The number of nodes in a binary tree is the number of nodes in its left subtree plus the number of nodes in its right subtree.

A)True

B)False

Q2) The smallest number of levels that a binary tree with three nodes can have is two.

A)True

B)False

Q3) Binary search trees may be implemented as templates, but any data types used with them should support the ________ operator.

A) <

B) >

C) ==

D) All of the above

E) None of the above

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

A)True

B)False

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