Skip to main content

Programming Fundamentals Practice Exam - 899 Verified Questions

Page 1


Programming Fundamentals

Practice Exam

Course Introduction

Programming Fundamentals introduces students to the core principles and concepts of computer programming. Students will learn the basics of algorithm development, problem-solving strategies, and structured programming using a high-level programming language. Key topics include variables, data types, control structures, loops, functions, arrays, and basic input/output operations. This course emphasizes writing clear, well-documented code and provides practical experience through hands-on exercises and projects designed to build a strong foundation for more advanced study in computer science and software development.

Recommended Textbook C++ Programming From Problem Analysis to Program Design 6th Edition by

Available Study Resources on Quizplus

18 Chapters

899 Verified Questions

899 Flashcards

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

Chapter 1: An Overview of Computers and Programming Languages

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) The device that stores information permanently (unless the device becomes unusable or you change the information by rewriting it) is called primary storage.

A)True

B)False

Answer: False

Q2) ____________________ signals represent information with a sequence of 0s and 1s.

Answer: Digital digital

Q3) When the power is switched off, everything in ____ is lost.

A) main memory

B) secondary storage

C) hard disks

D) floppy disks

Answer: A

Q4) Main memory is called ____.

A) read only memory

B) random access memory

C) read and write memory

D) random read only memory

Answer: B

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

Chapter 2: Basic Elements of C

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) The value of the expression 33/10, assuming both values are integral data types, is

A) 0.3

B) 3

C) 3.0

D) 3.3

Answer: B

Q2) The value of the expression 17 % 7 is ____.

A) 1

B) 2

C) 3

D) 4

Answer: C

Q3) Which of the following is the newline character?

A) \r

B) \n

C) \l

D) \b

Answer: B

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

Page 4

Chapter 3: Inputoutput

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) To use the manipulator setprecision, the program must include the header file

Answer: iomanip

Q2) C++ comes with a wealth of functions, called ____________________ functions, that are written by other programmers.

Answer: predefined pre defined pre-defined

Q3) On some compilers, the statements cin >> left; and cin >> right; might not work. In this case, you can use the statement ____________________ in place of cin >> left;. Answer: cin.setf(ios::left);

Q4) In the statement cin >> x;, x can be a variable or an expression. A)True B)False

Answer: False

Q5) On some compilers, the statements cin >> fixed; and cin >> scientific; might not work. In this case, you can use the statement ____________________ in place of cin >> fixed;.

Answer: cin.setf(ios::fixed);

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

Chapter 4: Control Structures I Selection

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Which of the following operators has the lowest precedence?

A) !

B) ||

C) &&

D) =

Q2) A control structure alters the normal sequential flow of execution in a program.

A)True

B)False

Q3) What is the value of x after the following statements execute? int x;

X = (5 <= 3 && 'A' < 'F') ? 3 : 4

A) 2

B) 3

C) 4

D) 5

Q4) Which of the following operators has the highest precedence?

A) !

B) *

C) %

D) =

Q5) The value of the expression 7 + 8 <= 15 is ____________________.

Page 6

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

Chapter 5: Control Structures II Repetition

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) A(n) ____-controlled while loop uses a bool variable to control the loop.

A) counter

B) sentinel

C) flag

D) EOF

Q2) In a(n) "____________________" problem, either the loop executes one too many or one too few times.

Q3) Suppose sum, num, and j are int variables, and the input is 4 7 12 9 -1. What is the output of the following code? cin >> sum; cin >> num; for (j = 1; j <= 3; j++)

{ \(\quad\)cin >> num; \(\quad\)sum = sum + num; }

cout << sum << endl;

A) 24

B) 25

C) 41

D) 42

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

Chapter 6: User-Defined Functions

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Using functions greatly enhances a program's readability because it reduces the complexity of the function main.

A)True

B)False

Q2) The data type of a variable in a return statement must match the function type.

A)True

B)False

Q3) The following function heading in a C++ program is valid: int funcExp(int u, char v, float g)

A)True

B)False

Q4) Given the following function prototype: int myFunc(int, int);, which of the following statements is valid? Assume that all variables are properly declared.

A) cin >> myFunc(y);

B) cout << myFunc(myFunc(7, 8), 15);

C) cin >> myFunc('2', '3');

D) cout << myFunc(myFunc(7), 15);

Q5) A(n) ____________________ parameter s a formal parameter that receives a copy of the content of the corresponding actual parameter.

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

Chapter 7:

User-Defined Simple Data Types, Namespaces, and the String Type

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) What is the output of the following code? enum courses {ALGEBRA, BASIC, PASCAL, PHILOSOPHY, ANALYSIS}; courses registered; registered = ALGEBRA; cout << registered << endl; A) ALGEBRA B) 0 C) 1 D) "ALGEBRA"

Q2) Given the following code namespace globalType { Void printResult(); }

Which of the following statements is needed to access printResult? A) globalType.printResult(); B) globalType.printResult; C) globa

Q3) The values in the domain of an enumeration type are called

9

Q4) Suppose str = "abcd"; After the statement str[1] = 'A'; The value of str is "____________________".

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

Chapter 8: Arrays and Strings

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) When you pass an array as a parameter, the base address of the actual array is passed to the formal parameter.

A)True

B)False

Q2) Arrays can be passed as parameters to a function by value, but it is faster to pass them by reference.

A)True

B)False

Q3) Consider the following declaration: char str[15];. Which of the following statements stores "Blue Sky" into str?

A) str = "Blue Sky";

B) str[15] = "Blue Sky";

C) strcpy(str, "Blue Sky");

D) strcpy("Blue Sky");

Q4) The one place where C++ allows aggregate operations on arrays is the input and output of C-strings.

A)True

B)False

Q5) The statement strlen("Marylin Stewart"); returns ____________________.

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

Chapter 9: Records Structs

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Consider the following statements: struct rectangleData { \(\quad\)double length; \(\quad\)double width; \(\quad\)double area; \(\quad\)double perimeter; };

rectangleData bigRect; rectangleData smallRect;

Which of the following statements is legal in C++?

A) if (bigRect == smallRect)

B) if (bigRect != smallRect)

C) if (bigRect.length == width)

D) if (bigRect.length == smallRect.width)

Q2) A(n) ____________________ is a set of elements of the same type.

Q3) Aggregate input/output operations are allowed on a struct variable.

A)True

B)False

Q4) Both arrays and structs are examples of ____________________ data types.

Q5) Arrays are passed by ____________________ only.

11

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

Chapter 10: Classes and Data Abstraction

Available Study Resources on Quizplus for this Chatper

49 Verified Questions

49 Flashcards

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

Sample Questions

Q1) A(n) ____________________ function of a class changes the values of the member variable(s) of the class.

Q2) Classes were specifically designed in C++ to handle ____________________.

Q3) The header file is also known as the ____________________.

Q4) A class and its members can be described graphically using a notation known as the ____ notation.

A) OON

B) OOD

C) UML

D) OOP

Q5) You can use arithmetic operators to perform arithmetic operations on class objects. A)True

B)False

Q6) A ____ sign in front of a member name on a UML diagram indicates that this member is a public member.

A) +

B) -

C) #

D) $

Page 12

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

Chapter 11: Inheritance and Composition

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Inheritance is an example of a(n) ____ relationship.

A) is-a

B) has-a

C) handshaking

D) had-a

Q2) If inheritance is public, all protected members of the base class are ____________________ members of the derived class.

Q3) The ____ members of an object form its internal state.

A) private

B) protected

C) public

D) static

Q4) ____ is the ability to use the same expression to denote different operations.

A) Inheritance

B) Encapsulation

C) Polymorphism

D) Composition

Q5) A derived class cannot directly access public members of a base class.

A)True

B)False

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

Chapter 12: Pointers, Classes, Virtual Functions, and

Abstract Classes

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) In C++, ____ is called the address of operator.

A) &

B) *

C) #

D) ->

Q2) Variables that are created during program execution are called static variables.

A)True

B)False

Q3) Consider the following statement: ptrMemberVarType objectThree(objectOne); The values of the member variables of objectOne are being copied into the corresponding member variables of objectThree. This initialization is called the ____.

A) member-wise assignment

B) default assignment

C) member-wise initialization

D) default initialization

Q4) In C++, pointer variables are declared using the reserved word pointer. A)True

B)False

Q5) The binding of virtual functions occurs at program

time.

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

Chapter 13: Overloading and Templates

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Which of the following is the general syntax of the function prototype to overload the post-increment operator as a member function?

A) className operator++();

B) friend className operator++();

C) className operator++(int);

D) friend className operator++(int);

Q2) Operator functions typically return void.

A)True

B)False

Q3) The ____________________ members of a class are local to the class and, therefore, cannot be accessed outside of the class.

Q4) Classes with pointer member variables must include the ____________________ constructor.

Q5) The return type of the function operator == is ____.

A) int

B) bool

C) char

D) void

Q6) In C++, a function ____________________ can be overloaded.

Page 15

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

Chapter 14: Exception Handling

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) An object that is being thrown cannot be an anonymous object.

A)True

B)False

Q2) The class ____________________ contains the function what.

Q3) The class ____________________ deals with the string subscript out of range error.

Q4) In a sequence of try/catch blocks, the last catch block of that sequence should be ____.

A) catch(...){ }

B) catch(int x){ }

C) catch(str){ }

D) catch(exception){}

Q5) One of the typical ways of dealing with exceptions is to use an if statement.

A)True

B)False

Q6) The function ____ returns a string containing an appropriate message.

A) where

B) what

C) when

D) log

Page 16

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

Chapter 15: Recursion

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Consider the following definition of the recursive function mystery. int mystery(int num)

{ if (num <= 0)

\(\quad\)return 0; else if (num % 2 == 0)

\(\quad\)return num + mystery(num - 1); else

\(\quad\)return num * mystery(num - 1);

}

What is the output of the following statement?

cout << mystery(5) << endl;

A) 50

B) 65

C) 120

D) 180

Q2) The ____________________ Fibonacci number in a sequence is the sum of the second and third Fibonacci numbers.

Q3) The numbering system that a computer uses is called the ____________________ system.

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

Chapter 16: Searching, Sorting and the Vector Type

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) The bubble sort makes fewer item assignments than comparisons with a list of 1000 elements.

A)True

B)False

Q2) For a list size of 1000, on average, the sequential search makes about ____________________ key comparisons.

Q3) The first element in a vector object is at location ____________________.

Q4) The statement vector&lt;elemType&gt;____________________; creates the vector object vecList of size n.

Q5) Sequential search typically searches ____.

A) one quarter of the list

B) one third of the list

C) one half of the list

D) the entire list

Q6) The sequential search algorithm does not assume that the list is sorted.

A)True

B)False

Q7) The type vector provides the function ____________________, which deletes all elements from the object.

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

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) A linked list must be searched ____________________, starting from the first node.

Q2) Each node of a linked list must store the data as well as the ____________________ for the next node in the list

Q3) In a circular linked list with more than one node, it is convenient to make the pointer first point to the ____________________ node of the list.

Q4) The ____________________ constructor executes when an object is declared and initialized using another object.

Q5) The ____ deallocates the memory occupied by the nodes of a list when the class object goes out of scope.

A) constructor

B) destructor

C) head pointer

D) tail pointer

Q6) The ____________________ constructor can make an identical copy of a linked list.

Q7) In a linked list, the link component of each node is a(n) ____________________.

Q9) In C++, the dereferencing operator is ____________________. Page 19

Q8) The nodes of an ordered list are in ____________________ order.

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

Page 20

Chapter 18: Stacks and Queues

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) You can perform the operation ____ to remove the top element from the stack.

A) dequeue

B) top

C) pop

D) push

Q2) To describe a queuing system, we use the term ____ for the object receiving the service.

A) client

B) server

C) customer

D) provider

Q3) In the linked implementation of stacks, the memory to store the stack elements is allocated statically.

A)True

B)False

Q4) In a(n) ____________________ simulation, the clock is implemented as a counter, and the passage of, say, one minute can be implemented by incrementing the counter by 1.

Q5) In ____________________ notation, operators are written after the operands.

Page 21

Q6) An array is a(n) ____________________ access data structure.

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

Turn static files into dynamic content formats.

Create a flipbook