Programming Fundamentals Question Bank - 899 Verified Questions

Page 1


Programming Fundamentals

Question Bank

Course Introduction

Programming Fundamentals introduces students to the essential concepts and constructs of computer programming. The course covers key topics such as variables, data types, control structures (including loops and conditionals), functions, and basic input/output operations. Students will gain hands-on experience with problem-solving, algorithm development, and code debugging while working with a contemporary programming language. By the end of the course, learners develop a solid foundation in programming principles that will prepare them for more advanced study in computer science and related fields.

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) ____ consists of 65,536 characters.

A) ASCII-8

B) ASCII

C) Unicode

D) EBCDIC

Answer: C

Q2) The devices that feed data and programs into computers are called ____ devices.

A) entry

B) input

C) output

D) secondary

Answer: B

Q3) In object-oriented design, the first step in the problem-solving process is to identify the components called ____________________, which form the basis of the solution, and to determine how they interact with one another.

Answer: objects

Q4) To develop a program to solve a problem, you start by analyzing the problem.

A)True

B)False

Answer: True

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) In C++, reserved words are the same as predefined identifiers.

A)True

B)False

Answer: False

Q2) The length of the string "computer science" is ____.

A) 14

B) 15 C) 16

D) 18

Answer: C

Q3) A data type is called ____________________ if the variable or named constant of that type can store only one value at a time.

Answer: simple

Q4) A comma is also called a statement terminator.

A)True

B)False

Answer: False

Q5) The ____________________ type is C++ 's method for allowing programmers to create their own simple data types.

Answer: enumeration

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) What is the output of the following statements? cout << "123456789012345678901234567890" << endl

Cout << setfill('#') << setw(10) << "Mickey" << setfill(' ') << setw(10) << "Donald" << setfill('*') << setw(10) << "Goofy" << endl;

A) 123456789012345678901234567890

####Mickey Donald*****Goofy

B) 123456789012345678901234567890

####Mickey####Donald*****Goofy

C) 123456789012345678901234567890

####Mickey####Donald#####Goofy

D) 23456789012345678901234567890

****Mickey####Donald#####Goofy

Answer: A

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

Answer: iomanip

Q3) C++ has a special name for the data types istream and ostream. They are called

Answer: classes

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) Suppose P and Q are logical expressions. The logical expression P && Q is true if both P and Q are true.

A)True

B)False

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

A)True

B)False

Q3) Every else must be paired with a(n) ____________________.

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

Q5) Assume you have three int variables: x = 2, y = 6, and z. Choose the value of z in the following expression: z = (y / x > 0) ? x : y;.

A) 2

B) 3

C) 4

D) 6

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

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) What is the output of the following C++ code? num = 10; while (num > 10)

\(\quad\)num = num - 2;

cout << num << endl;

A) 0

B) 6

C) 8

D) 10

Q2) The ____________________ loop has an exit condition but no entry condition.

Q3) In ____ structures, the computer repeats particular statements a certain number of times depending on some condition(s).

A) looping

B) branching

C) selection

D) sequence

Q4) The number of iterations of a counter-controlled loop is known in advance.

A)True

B)False

Q5) A semicolon at the end of the for statement (just before the body of the loop) is a(n) ____________________ error.

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

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) If a formal parameter is a nonconstant reference parameter, during a function call, its corresponding actual parameter must be a(n) ____________________.

Q2) Given the function prototype: float test(int, int, int);

Which of the following statements is legal?

A) cout << test(7, test(14, 23));

B) cout << test(test(7, 14), 23);

C) cout << test(14, 23);

D) cout << test(7, 14, 23);

Q3) Assume the following. static_cast&lt;int&gt;('a') = 97

Static_cast&lt;int&gt;('A') = 65

The output of the statement:

Cout << static_cast&lt;int&gt;(tolower('B')) << endl; is ____.

A) 65

B) 67

C) 96

D) 98

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

Q5) In C++, :: is called the ____________________.

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) The length of the string "Hello There. " is ____.

A) 11

B) 12

C) 13

D) 14

Q2) Which of the following statements creates an anonymous type?

A) enum grades {A, B, C, D, F};

B) enum grades {};

C) enum {};

D) enum {A, B, C, D, F} grades;

Q3) In C++, you can create aliases to a previously defined data type by using the ____ statement.

A) typedef

B) using C) namespace

D) alias

Q4) The data type string has a named constant, ____________________, associated with it.

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

Q5) The string expression strVar.____________________ inserts all the characters of str at index pos into strVar.

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) In a two-dimensional array, the elements are arranged in a table form.

A)True

B)False

Q2) In C++, the null character is represented as ____.

A) '\0'

B) "\0"

C) '0'

D) "0"

Q3) What is the value of alpha[2] after the following code executes? int alpha[5]; Int j;

For (j = 0; j < 5; j++)

Alpha[j] = 2 * j + 1;

A) 1

B) 4

C) 5

D) 6

Q4) The word ____________________ is used before the array declaration in a function heading to prevent the function from modifying the array.

Q5) The function ____________________ returns the length of the string s, excluding the null character.

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) Which of the following struct definitions is correct in C++?

A) struct studentType

{ \(\quad\)int ID; };

B) struct studentType

{ \(\quad\)string name; \(\quad\)int ID; \(\quad\)double gpa;

C) int struct studentType

{ \(\quad\)ID; }

D) struct studentType

{ \(\quad\)int ID = 1;

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

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

Page 11

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 class object can be ____. That is, it can be created once, when the control reaches its declaration, and destroyed when the program terminates.

A) static

B) automatic

C) local

D) public

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

A) +

B) -

C) #

D) $

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

B)False

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

Q5) By default, all members of a class are ____________________.

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

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) In multiple inheritance, the derived class has more than one base class.

A)True

B)False

Q2) In the case of composition, the ____________________ name is used to invoke the constructor.

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

Q4) The ____ members of an object form its external state.

A) private

B) public

C) protected

D) static

Q5) To ____ a public member function of a base class in the derived class, the corresponding function in the derived class must have the same name, number, and types of parameters.

A) redefine

B) overload

C) rename

D) reuse

Q6) Objects are created when ____________________ variables are declared.

Page 13

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

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) If p is a pointer variable, the statement p = p + 1; is valid in C++.

A)True

B)False

Q2) The C++ operator ____ is used to create dynamic variables. A) dynamic B) new C) virtual D) dereferencing

Q3) Once a class contains one or more pure virtual functions, then that class is called a(n) ____________________ class.

Q4) Given the declaration int *p;

The statement p = new int[50]; dynamically allocates an array of 50 components of type int and p contains the base address of the array.

A)True B)False

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

Q5) The statement that declares board to be a pointer to a pointer is: int ____________________;

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) A class template is called a(n) ____________________ type because it specifies how a generic class template is to be customized to form a specific template class.

Q2) Which of the following function prototypes overloads the != operator for the class rectangleType?

A) bool operator!=(rectangle&) const;

B) bool operator!=(const rectangleType&) const;

C) int operator!=(const rectangleType) const;

D) int operator!=(rectangle&) const;

Q3) Using a class template, you can write a single code segment for a set of related ____.

A) classes

B) functions

C) operators

D) constructors

Q4) Class templates are called ____ types.

A) polymorphic

B) structured

C) member

D) parameterized

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) When an exception is thrown in a function, the function can do the following: ____________________; partially process the exception and throw the same exception or a new exception; or throw a new exception.

Q2) The string concatenation operator is represented by the ____________________ symbol.

Q3) Throwing an exception is typically done using the ____________________ statement.

Q4) If, during program execution, division by ____________________ occurs with integer values and is not addressed by the program, the program might terminate with an error message or might simply hang.

Q5) To use the assert function in your program, you should include the statement ____. A) #include &lt;assert&gt; B) #include &lt;cassert&gt; C) #include &lt;iostream&gt; D) #include &lt;exception&gt;

Q6) One of the typical ways of dealing with exceptions is to use an if statement. A)True B)False

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

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) If every recursive call results in another recursive call, then the recursive function (algorithm) is said to have ____ recursion.

A) unlimited

B) indefinite

C) infinite

D) tail

Q2) You can use a recursive algorithm to find the largest element in an array.

A)True

B)False

Q3) A recursive function in which the last statement executed is the recursive call is called a(n) ____ recursive function.

A) direct

B) tail

C) indefinite

D) indirect

Q4) Let x be an integer. We call the ____________________ of x after division by 2 the rightmost bit of x.

Q5) If a function A calls a function B and function B calls function A, then function A is ____________________ recursive.

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 type vector provides the function ____________________, which returns the first element in the vector object.

Q2) In a bubble sort for list of length n, the first step is to compare elements ____.

A) list[0] and list[n]

B) list[0] and list[n-1]

C) list[0] and list[1]

D) list[n-1] and list[n+1]

Q3) A variable declared using the vector type is called a ____.

A) vector element

B) vector array

C) vector list

D) vector container

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

Q5) Assume that n = 1000. To sort the list, insertion sort makes about 250,000 item assignments.

A)True

B)False

Q6) In order to apply a(n) ____________________ search, the list must be sorted.

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) The steps involved in inserting a new item at the beginning of an unordered linked list are ____.

A) 1. Create a new node. 2. Insert the node before first.

3) Increment the counter by 1.

B) 1. Create a new node. 2. Store the new item in the new node.

3) Insert the node before first.

4) Increment the counter by 1.

C) 1. Create a new node. 2. Store the new item in the new node.

3) Insert the node before first.

D) 1. Create a new node. 2. Store the new item in the new node.

3) Insert the node before first.

4) Decrement the counter by 1.

Q2) Linked lists allow you to overcome the size limitations of an array data type.

A)True

B)False

Q3) A linked list is a random access data structure.

A)True

B)False

Q4) In C++, the dereferencing operator is ____________________.

Q5) In a linked list, the link component of each node is a(n)

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

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) What is the output of the following code? stackType&lt;int&gt; stack; int x, y; x = 4; y = 2; stack.push(6); stack.push(x); stack.push(x + 1); y = stack.top(); stack.pop(); stack.push(x + y); x = stack.top(); stack.pop();

cout << "x = " << x << endl;

A) x = 4

B) x = 5

C) x = 6

D) x = 9

Q2) The ____________________ constructor is called when a stack object is passed as a (value) parameter to a function.

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

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

Turn static files into dynamic content formats.

Create a flipbook