Skip to main content

Programming Fundamentals Practice Questions - 766 Verified Questions

Page 1


Programming Fundamentals

Practice Questions

Course Introduction

Programming Fundamentals introduces the essential concepts and skills required to begin writing computer programs. This course covers fundamental topics such as data types, variables, operators, control structures (including sequence, selection, and loops), functions, arrays, and the basics of input/output operations. Students will develop problem-solving abilities by designing, coding, and testing simple programs using a high-level programming language. Emphasis is placed on logical thinking, debugging techniques, and best practices for writing clear, efficient, and well-documented code, laying the foundation 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) Once a value has been stored in a variable it cannot be changed.

A)True

B)False

Answer: False

Q2) Which of the following is an example of a secondary storage device?

A) a hard disk drive

B) a USB flash drive

C) a CD

D) a DVD

E) all of the above

Answer: E

Q3) The purpose of the compiler is to convert object code into source code.

A)True

B)False

Answer: False

Q4) Most of the lines in a program contain something meaningful; however, some of the lines may contain nothing at all.

A)True

B)False

Answer: True

Page 3

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

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 ________ is used to display information on the computer's screen.

A) < symbol

B) cin object

C) cout object

D) print object

E) output object

Answer: C

Q2) #include &lt;iostream&gt; is an example of a(n)

A) comment.

B) I/O statement.

C) preprocessor directive.

D) stream directive.

E) compiler option.

Answer: C

Q3) C++ is a case-sensitive language.

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) ________ can be used to override the rules of operator precedence.

A) Some operators

B) Parentheses

C) Operands

D) Associativity

E) Nothing

Answer: B

Q2) The following C++ statement will assign 1.5 to the result variable. int result = 3.0 / 2.0;

A)True

B)False

Answer: False

Q3) The statement cout << setw(4) << num4 << " ";

A) outputs the value of num4 rounded to 4 decimal places.

B) outputs "setw(4)" before the value in the variable num4.

C) outputs the first 4 digits of the number stored in num4.

D) outputs the value stored in num4 four times.

E) does none of above.

Answer: E

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) logical operators AND and OR have a higher precedence than the NOT operator.

A)True

B)False

Q2) A trailing else placed at the end of an if/else if statement provides a default action when ________ of the if conditions is/are True.

A) none

B) any one

C) only the last one

D) at least two

E) all

Q3) The ________ statement acts like a chain of if statements. Each performs its test, one after the other, until one of them is found to be True or until the construct is exited without any test ever evaluating to True.

A) if/then

B) if/else

C) if/else if

D) if/not if

E) if/endif

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

Q2) The statements in the body of a do-while loop are executed

A) only if the test condition is initially True.

B) at least once.

C) until the test condition becomes True.

D) until an exit statement is encountered.

E) forever until the user presses the break key.

Q3) The statements in the body of a do-while loop are executed

A) exactly once.

B) at least once.

C) only if the test condition is initially True.

D) until the test condition becomes True.

E) forever until the user hits the break key.

Q4) Before beginning to add value to it, an accumulator should be initialized to 1.

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 function can have zero to many parameters and either zero or one return value(s).

A)True

B)False

Q2) A(n) ________ is information that is passed to a function, and a(n) ________ is a special variable that receives and holds that information.

A) function call, function header

B) function prototype, function header

C) parameter, argument

D) argument, parameter

E) formal argument, actual argument

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

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) If setRadius is a Circle class function and myCircle is a Circle object, which of the following statements would set myCircle's radius to 2.5?

A) setRadius(2.5);

B) myCircle.setRadius(2.5);

C) Circle.setRadius(2.5);

D) Circle(setRadius(2.5));

E) None of the above

Q2) A class can have a member variable that is an instance of another class. This is called object nesting.

A)True

B)False

Q3) When a member function is defined outside of the class declaration, the function name must be qualified with the class name, followed by A) a semicolon(;).

B) the scope resolution operator (::).

C) the public access specifier.

D) the private access specifier.

E) a tilde (~).

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

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) In C++ If you attempt to store more data in an array than it can hold, the compiler will issue an error.

A)True

B)False

Q2) When you create a vector it is unnecessary to specify how many elements it will hold because it will expand in size as you add new values to it.

A)True

B)False

Q3) An array can store multiple values, but the values must be

A) all the same data type.

B) declared at the time the array is created.

C) constants.

D) numeric, not characters or strings.

E) none of the above.

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

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) We can estimate the ________ of an algorithm by counting the number of basic steps it requires to solve a problem.

A) number of lines of code

B) efficiency

C) run time

D) code quality

E) result

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) If the item being searched for is not in the array, binary search stops looking for it and reports that it is not there when A) array index first > array index last.

B) Boolean variable found equals false.

C) Boolean variable found equals True.

D) it finds a value larger than the search key.

E) it has examined all the elements in the array.

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

Q2) Suppose that a function dynamically allocates a block of memory with a local pointer variable p pointing to the allocated block. Suppose further that there are no other pointers referencing that block of memory, and the function returns without doing a delete on p. Then

A) the pointer p becomes a dangling pointer.

B) the compiler will automatically deallocate the memory pointed to by p.

C) the program will suffer from memory leaks.

D) the returning function will throw the bad_alloc exception.

E) None of the above

Q3) An array name is a pointer constant because the address it represents cannot be changed during run-time.

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) Arguments are passed to the base class destructor function by the ________ class ________ function.

A) derived, constructor

B) derived, destructor

C) base, constructor

D) base, destructor

E) None of the above

Q2) An ________ operator can work with programmer-defined data types.

A) inline

B) unconditional

C) overloaded

D) undefined

E) None of the above

Q3) When you overload the << operator, you must also overload the >> operator.

A)True

B)False

Q4) C++ permits you to overload the sizeof operator.

A)True

B)False

Page 13

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

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) A C-string is a sequence of characters stored in consecutive memory, terminated by a

A) period.

B) space.

C) null character.

D) semicolon.

E) None of the above

Q2) The following statement declares a string object and initializes it to "Once upon a time".

string theString("Once upon a time");

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

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

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) The ios::hardfail bit is set when an unrecoverable error occurs.

A)True

B)False

Q2) Opening a file with the flags ios::in | ios::out will preserve the contents of the file if the file already exists.

A)True

B)False

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

Q4) When used by itself, ________ causes a file's contents to be deleted if the file already exists.

A) ios:app

B) ios::in

C) ios::out

D) All of the above

E) None of the above

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) A ________ function is one that calls itself.

A) dynamic

B) static

C) recursive

D) data validation

E) None of the above

Q2) Recursive algorithms tend to be less efficient than iterative algorithms.

A)True

B)False

Q3) Indirect recursion means that a function calls itself several times.

A)True

B)False

Q4) When a function A calls a function B, which in turn calls A, we have

A) direct recursion.

B) indirect recursion.

C) function call cycling.

D) perfect recursion.

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 class with at least one pure virtual function is called

A) a pure virtual class.

B) a virtual base class.

C) an abstract class.

D) All of the above

E) None of the above

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

Q3) An abstract class is

A) one that has at least one pure virtual function.

B) one that supports polymorphism.

C) one that has all of its member functions declared private.

D) one that has all of its member variables declared private.

E) None of the above

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

Q3) Two types of container classes in the STL are

A) sequential and associative.

B) box and cylinder.

C) array and struct.

D) constant and literal.

E) None of the above

Q4) The line containing a throw statement is known as the throw point.

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

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

Q3) To build a linked list, we can

A) start with an empty list, and then form an array of nodes.

B) start with an empty list, and then perform a series of add item operations.

C) use the constructor to create an array of nodes.

D) call the list init function.

E) None of the above

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

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) A dynamic stack may be implemented as a(n) ________, and expand or shrink with each push or pop operation.

A) array

B) structure

C) linked list

D) A and B

E) None of the above

Q2) A(n) ________ is an abstract data type that stores and retrieves items in a last-in-first-out manner.

A) array

B) queue

C) stack

D) vector

E) None of the above

Q3) A stack that is implemented as a linked list is known as a deque.

A)True

B)False

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

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) In certain types of binary trees, the number of leaves can be greater than the number of nodes.

A)True

B)False

Q2) The width of a tree is the largest number of nodes at the same level.

A)True

B)False

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

Q4) There exists a binary tree with a hundred nodes, but only one leaf.

A)True

B)False

Q5) In a binary search tree, all nodes to the right of a node hold values greater than the node's value.

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
Programming Fundamentals Practice Questions - 766 Verified Questions by Quizplus - Issuu