Introduction To Programming Test Questions
Introduction To Programming Test Questions
Test Questions
https://quizplus.com/study-set/319
21 Chapters
1050 Verified Questions
Introduction to Programming
Test Questions
Cou
Introduction to Programming provides a foundational understanding of how computers
solve problems through software development. This course introduces students to core
programming concepts such as variables, data types, control structures, functions, and
well-structured code. By the end of the course, students will be equipped with essential
programming knowledge and practical coding experience needed for further study in
Recommended Textbook
C++ Programming Program Design Including Data Structures 6th Edition by D.S. Malik
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/128444
Sample Questions
Q1) When the computer is turned off,everything in secondary memory is lost.
A)True
B)False
Answer: False
Q2) The machine language version of the high-level language program is called
a(n)____________________.
Answer: object program
To view all questions and flashcards with answers, click on the resource link above.
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/5305
Sample Questions
Q1) Suppose that sum and num are int variables and sum = 5 and num = 10.After the
statement sum += num executes,____.
A) sum = 0
B) sum = 5
C) sum = 10
D) sum = 15
Answer: D
To view all questions and flashcards with answers, click on the resource link above.
Page 4
Chapter 3: Input/Output
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5306
Sample Questions
Q1) 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);
Q2) Manipulators without parameters are part of the ____ header file.
A) iostream
B) iomanip
C) ifstream
D) pmanip
Answer: A
Q5) 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);
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/5307
Sample Questions
Q1) The expression in an if statement is sometimes called a(n)____.
A) selection statement
B) action statement
C) decision maker
D) action maker
Q2) Suppose found = true and num = 6.The value of the expression (!found)|| (num > 6)is
____________________.
A)True
B)False
Q6) A control structure alters the normal sequential flow of execution in a program.
A)True
B)False
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/128467
Sample Questions
Q1) ____ loops are called posttest loops.
A) break
B) for
C) while
D) do...while
Q2) In the case of the sentinel-controlled while loop,the first item is read before the while
loop is entered.
A)True
B)False
Q3) Assume all variables are properly declared.The output of the following C++ code is 2
3 4 5.
n = 1;
while (n < 5)
{
\(\quad\)n++;
\(\quad\)cout << n << " ";
}
A)True
B)False
To view all questions and flashcards with Page 7 click on the resource link above.
answers,
Chapter 6: User-Defined Functions
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5309
Sample Questions
Q1) What value is returned by the following return statement? int x = 5;
Return x + 1;
A) 0
B) 5
C) 6
D) 7
Q5) When you attach & after the dataType in the formal parameter list of a function,the
variable following that dataType becomes a(n)____________________ parameter.
Sample Questions
Q1) Suppose that you have the following declaration. enum cars
{FORD,GM,TOYOTA,HONDA};
Cars domesticCars = FORD;
The statement:
DomesticCars = static_cast<cars>(domesticCars + 1);
Sets the value of domesticCars to ____.
A) FORD
B) GM
C) TOYOTA
D) HONDA
Q2) Suppose that str1,str2,and str3 are string variables.After the following statements
execute,the value of str3 is "____". str1 = "abc";
Str2 = "xyz";
Str3 = str1 + '-' + str2;
A) abc
B) xyz
C) abc-xyz
D) xyz-abc
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/5311
Sample Questions
Q1) The array index can be any integer less than the array size.
A)True
B)False
Q2) Suppose list is a one dimensional array of size 25,wherein each component is of type
int.Further,suppose that sum is an int variable.The following for loop correctly finds the
sum of the elements of list.
sum = 0;
for (int i = 0; i < 25; i++)
sum = sum + list;
A)True
B)False
Q3) What is the output of the following C++ code? int list[5] = {0,5,10,15,20};
int j;
for (j = 0; j < 5; j++)
\(\quad\)cout << list[j] << " ";
cout << endl;
A) 0 1 2 3 4
B) 0 5 10 15
C) 0 5 10 15 20
D) 5 10 15 20
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/5312
Sample Questions
Q1) Consider the following statements:
struct rectangleData
{
\(\quad\)double length;
\(\quad\)double width;
\(\quad\)double area;
\(\quad\)double perimeter;
};
rectangleData bigRect;
Which of the following statements is valid in C++?
A) cin >> bigRect.length >> width;
B) cout << bigRect.length;
C) cout << bigRect;
D) cout << length;
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
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/128469
Sample Questions
Q1) To create the object code file for any source code file,the command line option
____________________ is used on the system command line.
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
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/5314
Sample Questions
Q1) In ____________________ (aggregation),one or more members of a class are
objects of another class type.
Q3) In multiple inheritance,the derived class has more than one base class.
A)True
B)False
Page 13
To view all questions and flashcards with answers, click on the resource link above.
Chapter 12: Pointers, Classes, Virtual Functions, Abstract
Sample Questions
Q1) The copy constructor automatically executes when,as a parameter,an object is
passed by ____________________.
Q4) Variables that are created during program execution are called static variables.
A)True
B)False
D) dereferencing
To view all questions and flashcards with answers, click on the resource link above.
Chapter 13: Overloading and Templates
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5316
Sample Questions
Q1) Operator functions typically return void.
A)True
B)False
Q2) The general syntax to overload the assignment operator = for a class is ____.
A) friend className& operator=(const className&);
B) className& operator=(className&);
C) string className& operator=(className&);
D) const className& operator=(const className&);
Q4) Operators can be overloaded either for objects of the user-defined types,or for a
combination of objects of the user-defined type and objects of the built-in type.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above.
Page 15
Chapter 14: Exception Handling
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5317
Sample Questions
Q1) Which of the following statements creates a new exception class?
A) class myClass {};
B) class myClass {} implements exception;
C) class myExceptionClass {} extends exception;
D) class myExceptionClass {} throws exception;
Q3) When an exception occurs in a program,the programmer usually has three choices:
____________________ the program,include code in the program to recover from
the exception,or log the error and continue.
Q4) If no exception is thrown in a try block,all catch blocks associated with that try block
are ignored.
A)True
B)False
Q5) The class ____________________ deals with the string subscript out of range
error.
Q6) If the operator new cannot allocate memory space,this operator throws
a(n)____________________ exception.
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/5318
Sample Questions
Q1) Consider the following definition of the recursive function mystery. int mystery(int
first,int last)
{
if (first > last)
\(\quad\)Return 0;
else if (first == last)
\(\quad\)Return first;
else
\(\quad\)return first + mystery(first + 1,last - 1);
}
What is the output of the following statement?
cout << mystery(6,10)<< endl;
A) 13
B) 21
C) 40
D) 42
Sample Questions
Q1) 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 full.
D) Make a copy of the linked list.
Q2) The ____________________ operator advances the iterator to the next node in
the linked list.
Q3) You can use the pointer head of a linked list to traverse the list.
A)True
B)False
Q4) In a linked list,if a new item is always inserted at the beginning or at the end of the
list and the data read is unsorted,the linked list will be unsorted.
A)True
B)False
Q5) You deallocate the memory for a linked list by calling the operator clear.
A)True
B)False
Page 18
To view all questions and flashcards with answers, click on the resource link above.
Chapter 17: Stacks and Queues
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5320
Sample Questions
Q1) 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 one.
Q2) Postfix notation requires the use of parentheses to enforce operator precedence.
A)True
B)False
Q3) If you try to add a new item to a full stack,the resulting condition is called an outflow.
A)True
B)False
Q4) The default constructor for the linked implementation of a stack initializes the stack
to an empty state when a stack object is declared.
A)True
B)False
Q5) In the linked implementation of stacks,the memory to store the stack elements is
allocated statically.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above.
Page 19
Chapter 18: Searching and Sorting Algorithms
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5321
Sample Questions
Q1) The selection sort algorithm finds the location of the smallest element in the
unsorted portion of the list.
A)True
B)False
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) After the second iteration of bubble sort for a list of length n,the last ____ elements
are sorted.
A) two
B) three
C) n-2
D) n
Q4) Let f be a function of n.By the term ____________________,we mean the study
of the function f as n becomes larger and larger without bound.
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
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5322
Sample Questions
Q1) In a binary tree,the branches go only from a child to a parent.
A)True
B)False
Q2) For classes with pointer data members,you must explicitly overload the assignment
operator and include the destructor.
A)True
B)False
Q3) Let T be a binary search tree with n nodes,in which n > 0.When T is linear,the search
algorithm makes ____________________ key comparisons,in the unsuccessful
case.
Q5) All binary tree traversals start at the left-most child node.
A)True
B)False
Q6) After inserting an item in a binary search tree,the resulting binary tree must be
a(n)____________________.
To view all questions and flashcards with answers, click on the resource link above.
Page 21
Chapter 20: Graphs
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5323
Sample Questions
Q1) If the elements of E(G)are ordered pairs,G is called a(n)____ graph.
A) undirected
B) directed
C) weighted
D) spanning
Q4) A tree T is called a(n)____ tree of graph G if T is a subgraph of G such that V(T)=
V(G); that is,if all vertices of G are in T.
A) weighted
B) spanning
C) rooted
D) directed
Sample Questions
Q1) The operator ____________________,supported by the queue container
class,returns the next (i.e.,first)element in the queue,but does not remove the element
from the queue.
Q2) The deq.front()operation on a deque object checks whether the container is empty.
A)True
B)False
Q4) A container's ____ executes when the object goes out of scope.
A) default constructor
B) destructor
C) copy constructor
D) iterator
Page 23
To view all questions and flashcards with answers, click on the resource link above.