Skip to main content

Programming Methodology Exam Bank - 881 Verified Questions

Page 1


Programming Methodology Exam Bank

Course Introduction

Programming Methodology introduces the fundamental principles and techniques of computer programming with an emphasis on problem-solving, designing, writing, and testing code. The course covers algorithm development, control structures, data types, and abstraction, often using a modern, high-level programming language. Students learn best practices in software engineering, such as modularity, documentation, and debugging, while gaining hands-on experience through practical exercises and projects. By the end of the course, participants will be equipped with a systematic approach to program design and a solid foundation for further studies in computer science.

Recommended Textbook

C++ Programming Program Design Including Data Structures 8th Edition by D. S. Malik

Available Study Resources on Quizplus

21 Chapters

881 Verified Questions

881 Flashcards

Source URL: https://quizplus.com/study-set/3128 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/128445

Sample Questions

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

A) entry

B) input

C) output

D) secondary

Answer: B

Q2) The basic commands that a computer performs are input (get data), output (display result), storage, and performance of arithmetic and logical operations.

A)True

B)False

Answer: True

Q3) Assembly language uses easy-to-remember instructions called

Answer: mnemonics

Q4) A program that loads an executable program into main memory is called a(n)

A) compiler

B) loader

C) linker

D) assembler

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

Sample Questions

Q1) ____ is a valid int value.

A) 46,259

B) 46259

C) 462.59

D) -32.00

Answer: B

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

A) 1

B) 2

C) 3

D) 4

Answer: C

Q3) A comma is also called a statement terminator.

A)True

B)False

Answer: False

Q4) A(n) ____________________ is a memory location whose contents can be changed.

Answer: variable

Q5) The memory space for a(n) ____________________ data value is 64 bytes. Answer: long long

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

Sample Questions

Q1) Suppose that ch1 and ch2 are char variables, and alpha is an int variable.The input is: A 18

What are the values after the following statement executes?

Cin)get(ch1);

Cin)get(ch2); Cin >> alpha;

A) ch1 = 'A', ch2 = ' ', alpha = 18

B) ch1 = 'A', ch2 = '1', alpha = 8

C) ch1 = 'A', ch2 = ' ', alpha = 1

D) ch1 = 'A', ch2 = '\n', alpha = 1

Answer: A

Q2) The extraction operator >> skips only all leading blanks when searching for the next data in the input stream.

A)True

B)False

Answer: False

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

Sample Questions

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

A)True

B)False

Q2) Suppose found = true and num = 6.The value of the expression (!found) || (num > 6) is ____________________.

Q3) A compound statement functions as if it was a single statement.

A)True

B)False

Q4) The value of the expression 6 < 5 || 'g' > 'a' && 7 < 4 is ____________________.

A)True

B)False

Q5) Which of the following will cause a logical error if you are attempting to compare x to 5?

A) if (x == 5)

B) if (x = 5)

C) if (x <= 5)

D) if (x >= 5)

Q6) The ____________________ of relational and logical operators is said to be from left to right.

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) The control statements in the for loop include the initial statement, loop condition, and update statement.

A)True

B)False

Q2) A loop that continues to execute endlessly is called a(n) ____ loop.

A) end

B) unhinged

C) infinite

D) definite

Q3) In the case of the sentinel-controlled while loop, the first item is read before the while loop is entered.

A)True

B)False

Q4) The following while loop terminates when j > 20.

j = 0;

while (j < 20)

j++;

A)True

B)False

Q5) The function eof is a member of the data type ____________________.

Page 7

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

Chapter 6: User-Defined Function

Available Study Resources on Quizplus for this Chatper

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) A variable or expression listed in a call to a function is called the ____.

A) formal parameter

B) actual parameter

C) data type

D) type of the function

Q2) The output of the statement: cout << pow(3.0, 2.0) + 5 << endl; is ____.

A) 11.0 B) 12.0

C) 13.0 D) 14.0

Q3) Given the following function prototype: double tryMe(double, double);

Which of the following statements is valid? Assume that all variables are properly declared.

A) cin >> tryMe(x);

B) cout << tryMe(2.0, 3.0);

C) cout << tryMe(tryMe(double, double), double);

D) cout << tryMe(tryMe(float, float), float);

Q4) The ____________________ of a function consists of the function name and its formal parameter list.

Page 8

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

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

Sample Questions

Q1) The length of the string "Hello There." is ____.

A) 11

B) 12

C) 13

D) 14

Q2) An anonymous type can be passed as a parameter to a function.

A)True

B)False

Q3) In C++, ____ is a reserved word.

A) deftype

B) typedef

C) typecc

D) alias

Q4) Which of the following statements declares the studentGrade variable?

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

B) enum int {A, B, C, D, F} studentGrade;

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

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

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

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

Chapter 8: Arrays

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) Which of the following correctly declares name to be a character array and stores "William" in it?

A) char name[6] = "William";

B) char name[7] = "William";

C) char name[8] = "William";

D) char name[8] = 'William';

Q2) All components of an array are of the same data type.

A)True

B)False

Q3) In a(n) ____________________ data type, each data item is a collection of other data items.

Q4) In a two-dimensional array, the elements are arranged in a table form. A)True B)False

Q5) The statement int list[25]; declares list to be an array of 26 components, since the array index starts at 0.

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

Sample Questions

Q1) A struct is a(n) ____________________, not a declaration.

Q2) Consider the following function prototype:int seqSearch(const listType& list, int searchItem); The actual parameter cannot be modified by ____.

A) seqSearch

B) listType

C) list

D) searchItem

Q3) Which of the following is an allowable aggregate operation on a struct?

A) Arithmetic

B) Assignment

C) Input/output

D) Comparison

Q4) A struct is typically a ____ data structure.

A) simple

B) dynamic

C) heterogeneous

D) linked

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

A)True

B)False

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

43 Verified Questions

43 Flashcards

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

Sample Questions

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

A) OON

B) OOD

C) UML

D) OOP

Q2) If a class object is passed by ____________________, the contents of the member variables of the actual parameter are copied into the corresponding member variables of the formal parameter.

Q3) Consider the accompanying class definition, and the declaration:rectangleType bigRect; Which of the following statements is correct?

A) rectangleType.print();

B) rectangleType::print();

C) bigRect.print();

D) bigRect::print();

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

Q5) Non-static member variables of a class are called the ____________________ variables of the class.

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

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) Which of the following is true about inheritance?

A) All public member functions of the base class become the public member functions of the derived class.

B) All public member variables of the base class become the public member variables of the derived class.

C) All public members of the base class become the public members of the derived class.

D) The public member variables of the base class become the public or private member variables of the derived class.

Q2) ____ is the ability to combine data, and operations on that data, in a single unit.

A) Inheritance

B) Encapsulation

C) Polymorphism

D) Composition

Q3) A derived class can directly access the protected members of the 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

44 Verified Questions

44 Flashcards

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

Sample Questions

Q1) In the statement

int* p, q; p and q are pointer variables.

A)True

B)False

Q2) In C++, the member access operator arrow is >>.

A)True

B)False

Q3) Which of the following arithmetic operations is allowed on pointer variables?

A) Increment

B) Modulus

C) Multiplication

D) Division

Q4) The statement that declares board to be an array of six pointers wherein each pointer is of type int is: int ____________________;

Q5) In a ____ copy, two or more pointers have their own data.

A) shallow

B) deep

C) static

D) dynamic

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

Chapter 13: Operator Overloading and Templates

Available Study Resources on Quizplus for this Chatper

41 Verified Questions

41 Flashcards

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

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) A(n) ____ function is a nonmember function that has access to all members of the class.

A) access

B) protected

C) friend

D) void

Q3) Which of the following is the syntax to declare the operator function operator[] as a member function of a class for nonconstant arrays?

A) Type& []operator(int index);

B) Type operator[](int index);

C) Type& operator[](int index);

D) Type [](int index);

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

15

Chapter 14: Exception Handling

Available Study Resources on Quizplus for this Chatper

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) All derived classes of the class exception override the function ____________________ to issue their own error messages.

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

Q3) Which of the following options should you choose when an exception occurs in a program that analyzes an airline's ticketing transactions?

A) Terminate the program.

B) Include code in the program to recover from the exception.

C) Log the error and continue.

D) Include code in the header file.

Q4) Which of the following is a valid C++ statement?

A) assert(0 = divisor);

B) assert(divisor != 0);

C) assert(divisor 0);

D) assert(divisor is 0);

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

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) In the Tower of Hanoi recursive program, if needle 1 contains three disks, then the number of moves required to move all three disks from needle 1 to needle 3 is 8.

A)True

B)False

Q2) A function is called ____ if it calls itself.

A) directly iterative

B) indirectly iterative

C) directly recursive

D) indirectly recursive

Q3) Which of the following solution methods would be the best choice for a mission control system?

A) Iterative

B) Direct recursive

C) Indirect recursive

D) Infinite recursive

Q4) Recursive algorithms are implemented using ____________________ functions.

Q5) Infinite recursions execute forever on a computer.

A)True

B)False

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

Chapter 16: Linked Lists

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) When you build a linked list in the backward manner, a new node is always inserted at the end of the linked list.

A)True

B)False

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

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

Q4) Which of the following is a basic operation on singly linked lists?

A) Retrieve the data of an arbitrary node.

B) Swap the head and the last nodes.

C) Determine whether the list is nearly full.

D) Make a copy of the linked list.

Q5) A(n) ____________________ linked list is a linked list in which every node has a next pointer and a back pointer.

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

Chapter 17: Stacks and Queue

Available Study Resources on Quizplus for this Chatper

43 Verified Questions

43 Flashcards

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

Sample Questions

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

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

A) head

B) bottom

C) top

D) middle

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

A) receiver

B) server

C) customer

D) provider

Q4) In a queuing system, every customer has a customer number, arrival time, ____________________ time, transaction time, and departure time.

Q5) The elements at the ____________________ of the stack have been in the stack the longest.

Q6) In the array representation of a stack, the stack is initialized simply by setting stackTop to ____________________.

Page 19

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

Chapter 18: Searching and Sorting Algorithms

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) In a binary search, first, the search item is compared with the last element of the list.

A)True

B)False

Q2) Suppose that L is a sorted list of size 1024, and we want to determine whether an item x is in L.From the binary search algorithm, it follows that every iteration of the while loop cuts the size of the search list by half.

A)True

B)False

Q3) When moving array values for insertion sort, to move list[4] into list[2], first ____.

A) move list[2] to list[3]

B) delete list[2]

C) move list[4] to list[3]

D) copy list[4] into temp

Q4) In a quick sort, all of the sorting work is done by the function

Q5) The ____________________ search algorithm is the optimal worst-case algorithm for solving search problems by using the comparison method.

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

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) A node in a binary tree is called a(n) ____ if it has no left and right children.

A) edge

B) branch

C) leaf

D) path

Q2) A binary tree is also a(n) ____.

A) stack

B) linked list

C) graph

D) array

Q3) In addition to the inorder, preorder, and postorder traversals, a binary tree can also be traversed level-by-level, which is also known as ____________________ traversal.

Q4) The key of the right child below the root node of a search binary tree is 40.The value in the root node could be ____.

A) 30

B) 40

C) 50

D) 60

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

Chapter 20: Graph Algorithms

Available Study Resources on Quizplus for this Chatper

48 Verified Questions

48 Flashcards

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

Sample Questions

Q1) The two most common graph traversal algorithms are depth first traversal and breadth first traversal.

A)True

B)False

Q2) A(n) ____________________ ordering of the vertices of the accompanying graph is 0, 1, 3, 4, 2, 5, 7, 8, 6, 9.

Q3) If two edges, e<sub>1</sub> and e<sub>2</sub>, are associated with the same pair of vertices {u, v}, then e<sub>1</sub> and e<sub>2</sub> are called ____ edges.

A) parallel

B) adjacent

C) connected

D) incident

Q4) The depth first traversal is similar to the postorder traversal of a binary tree. A)True

B)False

Q5) Let e (u, v) be an edge in an undirected graph G.The edge e is said to be ____________________ on the vertices u and v.

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

Page 22

Chapter 21: Standard Template Library

Available Study Resources on Quizplus for this Chatper

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) Every object in a(n) ____ container has a specific position.

A) adapter

B) sequence

C) associative

D) static

Q2) The definition of the function template copy is contained in the header file ____.

A) algorithm

B) copy

C) ioinput

D) std

Q3) An iterator to a vector container is declared using the ____ iterator.

A) new

B) vector

C) typedef

D) typeiter

Q4) Functions begin and end do not take any parameters.

A)True

B)False

Q5) List containers are implemented as doubly ____________________.

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

Turn static files into dynamic content formats.

Create a flipbook
Programming Methodology Exam Bank - 881 Verified Questions by Quizplus - Issuu