Programming Fundamentals Test Preparation - 751 Verified Questions

Page 1


Programming Fundamentals

Test Preparation

Course Introduction

Programming Fundamentals is an introductory course designed to equip students with the essential concepts and practices of computer programming. Through hands-on experience and theoretical instruction, students learn core topics such as data types, variables, control structures, functions, and basic problem-solving techniques. The course emphasizes logical thinking, algorithm development, and structured programming using a high-level programming language. By the end of the course, students gain the foundational skills necessary to design, write, test, and debug simple computer programs, forming a solid base for further studies in computer science and software development.

Recommended Textbook

C++ Programming From Problem Analysis to Program Design 8th Edition by D. S. Malik

Available Study Resources on Quizplus

18 Chapters

751 Verified Questions

751 Flashcards

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

Chapter 1: An Overview of Computers and Programming Languages

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

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

Answer: Digital digital

Q2) The command that does the linking on Visual C++ Express (2013 or 2016) and Visual Studio 2015 is Make or Remake.

A)True

B)False Answer: False

Q3) When you compile your program, the compiler identifies the logic errors and suggests how to correct them.

A)True

B)False

Answer: False

Q4) The ____ handles the overall activity of the computer and provides services.

A) central processing unit

B) operating system

C) arithmetic logic unit

D) control unit

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/62003

Sample Questions

Q1) When a value of one data type is automatically changed to another data type, a(n) ____________________ type coercion is said to have occurred.

Answer: implicit

Q2) The memory space for a(n) ____________________ data value is 64 bytes.

Answer: long long

Q3) Choose the output of the following C++ statement: cout << "Sunny " << '\n' << "Day " << endl;

A) Sunny \nDay

B) Sunny \nDay endl

C) Sunny Day

D) Sunny \n Day

Answer: C

Q4) ____ are executable statements that inform the user what to do.

A) Variables

B) Prompt lines

C) Named constants

D) Expressions

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) You can use the function getline to read a string containing blanks.

A)True

B)False

Answer: True

Q2) The number of input data extracted by cin and >> depends on the number of variables appearing in the cin statement.

A)True

B)False

Answer: True

Q3) The function ____________________ returns the next character in the input stream; it does not remove the character from the input stream.

Answer: peek

Q4) Manipulators without parameters are part of the ____ header file.

A) iostream

B) iomanip

C) ifstream

D) pmanip

Answer: A

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) In C++, && has a higher precedence than ||.

A)True

B)False

Q2) Which of the following is a relational operator?

A) =

B) ==

C) !

D) &&

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

A) !

B) *

C) %

D) =

Q4) The result of a logical expression cannot be assigned to an int variable, but it can be assigned to a bool variable.

A)True

B)False

Q5) In a switch statement, if the value of the expression does not match any of the case values, the statements following the ____________________ label execute.

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) In a sentinel-controlled while loop, the body of the loop continues to execute until the EOF symbol is read.

A)True

B)False

Q2) What executes immediately after a continue statement in a while and do-while loop?

A) loop-continue test

B) update statement

C) loop condition

D) the body of the loop

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

A) counter

B) sentinel

C) flag

D) EOF

Q4) The ____ statement can be used to eliminate the use of certain (flag) variables.

A) while

B) switch

C) break

D) if

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

Chapter 6: User-Defined Function

Available Study Resources on Quizplus for this Chatper

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) Given the following function prototype: Int test(float, char);

Which of the following statements is valid?

A) cout << test(12, &);

B) cout << test("12.0", '&');

C) int u = test(5.0, '*');

D) cout << test('12', '&');

Q2) Which of the following function prototypes is valid?

A) int funcTest(int x, int y, float z){}

B) funcTest(int x, int y, float){};

C) int funcTest(int, int y, float z)

D) int funcTest(int, int, float);

Q3) Functions that do not have a return type are called ____ functions.

A) zero

B) null

C) void

D) empty

Q4) Stream variables (for example, ifstream and ofstream) should be passed by ____________________ to a function.

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

Chapter 7: Namespaces, the Class String, and

User-Defined Simple Data Types

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) The following statement creates an anonymous type: enum {1ST, 2ND, 3RD, 4TH} places;

A)True

B)False

Q2) An enumeration type can be passed as a parameter to a function only by value.

A)True

B)False

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

Q4) Suppose str = "xyzw";. After the statement str[2] = 'Y'; The value of str is "____".

A) xyzw

B) xYzw

C) xyYw

D) xzYw

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

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/62009

Sample Questions

Q1) A collection of a fixed number of elements (called components) arranged in n dimensions (n >= 1) is called a(n) ____.

A) matrix

B) vector

C) n-dimensional array

D) parallel array

Q2) Assume you have the following declaration double salesData[1000];. Which of the following ranges is valid for the index of the array salesData?

A) 0 through 999

B) 0 through 1000

C) 1 through 1001

D) 1 through 1000

Q3) The form of the for loop shown below is called a(n) ____________________ for loop.

for (dataType identifier : arrayName) statements

Q4) The array index can be any integer less than the array size.

A)True

B)False

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) Consider the following statements: struct rectangleData { Double length; Double width; Double area; Double perimeter; };

RectangleData bigRect; Which of the following statements correctly initializes the component length of bigRect?

A) bigRect = {10};

B) bigRect.length = 10; C) length[0]= 10; D) bigRect[0]= 10

Q2) To access a structure member (component), you use the struct variable name together with the member name; these names are separated by a dot (period).

A)True B)False

Q3) Memory is allocated for struct variables only when you ____________________ them.

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

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) As parameters to a function, class objects can be passed by reference only.

A)True

B)False

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) In C++ terminology, a class object is the same as a class instance.

A)True

B)False

Q4) Consider the accompanying class definition, and the object declaration: rectangleType bigRect(14,10);

Which of the following statements is correct?

A) bigRect.setLengthWidth();

B) bigRect.setLengthWidth(3.0, 2.0);

C) bigRect.length = 2.0;

D) bigRect.length = bigRect.width;

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

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

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) If inheritance is private, all members of the base class, including private members, become private members of the derived class.

A)True

B)False

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

Q3) The constructor of a derived class cannot directly access the ____________________ member variables of the base class.

Q4) In protected inheritance, public and protected members of the base class become the protected members of the derived class.

A)True

B)False

Q5) Classes can create new classes from existing classes. This important feature ____.

A) encourages code reuse

B) aids the separation of data and operations

C) provides public access to the internal state of an object

D) results in more software complexity

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

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) The dereferencing operator is also known as the indirection operator and refers to the object to which its operand points.

A)True

B)False

Q2) A memory leak is an unused memory space that cannot be allocated.

A)True

B)False

Q3) The copy constructor automatically executes when, as a parameter, an object is passed by ____________________.

Q4) Run-time binding is also known as ____ binding.

A) static

B) shallow

C) dynamic

D) deep

Q5) The code int *p; declares p to be a(n) ____ variable.

A) new

B) num

C) pointer

D) address

Page 14

Q6) The binding of virtual functions occurs at program ____________________ time.

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

Page 15

Chapter 13: Overloading and Templates

Available Study Resources on Quizplus for this Chatper

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) Every object of a class maintains a (hidden) pointer to itself, and the name of this pointer is ____.

A) self

B) object

C) it

D) this

Q2) The associativity of the operator = is from right to left.

A)True

B)False

Q3) Which of the following is the general syntax of the function prototype to overload the pre-increment operator as a nonmember function?

A) className operator++();

B) friend className operator++();

C) className operator++(int);

D) friend className operator++(className&);

Q4) Both parameters of the function to overload the operator << are reference parameters.

A)True

B)False

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

Chapter 14: Exception Handling

Available Study Resources on Quizplus for this Chatper

42 Verified Questions

42 Flashcards

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

Sample Questions

Q1) A catch block can have, at most, ____ catch block parameter(s).

A) zero

B) one

C) two

D) three

Q2) The general syntax to rethrow an exception caught by a catch block is: ____ (in this case, the same exception is rethrown).

A) rethrow;

B) throw;

C) rethrow exception;

D) throw exception;

Q3) The statements that may generate an exception are placed in a ____ block.

A) throw

B) finally

C) try

D) catch

Q4) The heading of a try block can contain ellipses in place of a parameter.

A)True

B)False

Q5) In C++, throw is a(n) ____________________ word.

Page 17

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

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) Consider the accompanying definition of a recursive function. What is the output of the following statement? cout << puzzle(5, 10) << endl;

A) 720

B) 5040

C) 5760

D) 10800

Q2) Recursive algorithms are implemented using ____________________ functions.

Q3) To design a recursive function, you must determine the limiting conditions.

A)True

B)False

Q4) Consider the accompanying definition of a recursive function. What is the output of the following statement? cout << recFunc(10) << endl;

A) 10

B) 11

C) 100

D) 110

Q5) Suppose that function A calls function B, function B calls function C, function C calls function D, and function D calls function A. Function A is then ____________________ recursive.

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

Chapter 16: Searching and Sorting

Available Study Resources on Quizplus for this Chatper

46 Verified Questions

46 Flashcards

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

Sample Questions

Q1) All of the values in a list have the same type.

A)True

B)False

Q2) Which statement declares intList to be a vector of size 5 and the element to be of type int?

A) vector intList[5];

B) vector&lt;int&gt; intList(5);

C) vector&lt;int&gt; intList();

D) vector(int) intList[5];

Q3) The type vector provides the expression ____________________, which inserts a copy of elem into vecList at the end.

Q4) For a list of length n, the bubble sort makes exactly ____ key comparisons.

A) n(n-1)/2

B) n(n-1)/3

C) n(n-1)/4

D) (n-1)/2

Q5) The bubble sort makes fewer item assignments than comparisons.

A)True

B)False

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

Page 19

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

Chapter 17: Linked Lists

Available Study Resources on Quizplus for this Chatper

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) Because each node of a linked list has two components, we need to declare each node as a(n) ____.

A) reference and string

B) int and object

C) index and element

D) class or struct

Q2) When building a linked list in the ____ manner, a new node is always inserted at the end of the linked list.

A) backward

B) forward

C) traversal

D) random

Q3) A(n) ____________________ is an object that produces each element of a container, such as a linked list, one element at a time.

Q4) Every node in a doubly linked list has two pointers: ____ and ____.

A) top; bottom

B) back; next

C) current; forward

D) previous; forward

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

42 Verified Questions

42 Flashcards

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

Sample Questions

Q1) The addition and deletion of elements of a stack occurs only at the ____ of the stack.

A) head

B) bottom

C) top

D) middle

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

Q3) The bottom element of the stack is the last element added to the stack.

A)True

B)False

Q4) ____________________ techniques are used when it is too expensive or dangerous to experiment with real systems.

Q5) The following expression (a - b) * (c + d) is equivalent to which of the following postfix expressions?

A) a b c d - + *

B) a b - c d + *

C) a b - + c d *

D) - + * a b c d

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

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
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.