0% found this document useful (0 votes)
14 views23 pages

Introduction To Programming Test Questions

Introduction to Programming Test Questions available on Quizplus.com. The resource URL is https://quizplus.com/study-set/319-c-programming-program-design-including-data-structures

Uploaded by

8h34lmbgcu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views23 pages

Introduction To Programming Test Questions

Introduction to Programming Test Questions available on Quizplus.com. The resource URL is https://quizplus.com/study-set/319-c-programming-program-design-including-data-structures

Uploaded by

8h34lmbgcu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Introduction to Programming

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

basic algorithms using a popular programming language. Emphasis is placed on

developing logical thinking, computational problem-solving skills, and writing clear,

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

computer science or related disciplines.

Recommended Textbook
C++ Programming Program Design Including Data Structures 6th Edition by D.S. Malik

Available Study Resources on Quizplus


21 Chapters
1050 Verified Questions
1050 Flashcards
Source URL: https://quizplus.com/study-set/319

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

Q3) The structured design approach is also known as ____________________.


Answer: modular programming
top-down design
top down design
top-down
top down
bottom-up design
bottom up design
bottom-up
bottom up
stepwise refinement

Q4) A sequence of 0s and 1s is sometimes referred to as ____________________


Page 3
code.
Answer: binary

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

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


A) 1
B) 2
C) 3
D) 4
Answer: C

Q3) ____ is a valid char value.


A) -129
B) 'A'
C) 128
D) 129
Answer: B

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

Q3) cin is called a(n)____________________ object.


Answer: istream

Q4) To use a parameterized stream manipulator in a program,you must include the


header file ____________________.
Answer: iomanip

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

Q3) In C++,the logical operator AND is represented by ____________________.

Q4) The operators != and == have the same order of precedence.


A)True
B)False

Q5) The ____________________ of relational and logical operators is said to be


from left to right.

Q6) A control structure alters the normal sequential flow of execution in a program.
A)True
B)False

Q7) The symbol > is a(n)____________________ operator.


Page 6

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

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

Q4) A for loop is typically called a counted or ____________________ for loop.

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

Q2) A function ____________________ is a function that is not fully coded.

Q3) The heading of the function is also called the ____.


A) title
B) function signature
C) function head
D) function header

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

Q5) When you attach & after the dataType in the formal parameter list of a function,the
variable following that dataType becomes a(n)____________________ parameter.

To view all questions and flashcards with Page


answers,
8 click on the resource link above.
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/5310

Sample Questions
Q1) Suppose that you have the following declaration. enum cars
{FORD,GM,TOYOTA,HONDA};
Cars domesticCars = FORD;
The statement:
DomesticCars = static_cast&lt;cars&gt;(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

Q3) The data type string has a named


constant,____________________,associated
Page 9 with it.

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;

Q2) To compare struct variables,you compare them ____.


A) by reference
B) by value
C) index-wise
D) member-wise

Q3) In C++,struct is a(n)____________________ word.

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.

Q2) In C++ terminology,a class object is the same as a class instance.


A)True
B)False

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

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) A class is an example of a structured data type.


A)True
B)False

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

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


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

Sample Questions
Q1) In ____________________ (aggregation),one or more members of a class are
objects of another class type.

Q2) In ____________________ polymorphism,the (data)type is left unspecified and


then later instantiated.

Q3) In multiple inheritance,the derived class has more than one base class.
A)True
B)False

Q4) Objects are created when ____________________ variables are declared.

Q5) Consider the following class definition: class dClass: bClass


{
//class members list
};
The class dClass is derived from the class bClass using the ____ type of inheritance.
A) public
B) private
C) protected
D) static

Q6) In object-oriented design,we debug ____________________; in structured


programming,we debug functions.

Page 13
To view all questions and flashcards with answers, click on the resource link above.
Chapter 12: Pointers, Classes, Virtual Functions, Abstract

Classes, and Lists


Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5315

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

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


A) static
B) shallow
C) dynamic
D) deep

Q3) Which of the following can be used to initialize a pointer variable?


A) 1
B) NULL
C) "0"
D) '0'

Q4) Variables that are created during program execution are called static variables.
A)True
B)False

Q5) The C++ operator ____ is used to create dynamic variables.


A) dynamic
B) new
C) virtual Page 14

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

Q3) Suppose cType is a class template,which can take int as a parameter.The


statement: ____ declares x to be an object of type cType,and the type passed to the
class cType is int.
A) cType&lt;int&gt; x;
B) cType int x;
C) cType int = x;
D) cType int :: x;

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;

Q2) A(n)____________________ block specifies the type of exception it can catch


and contains an exception handler.

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.

Q7) The string concatenation operator is ____________________.


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

Q2) If you execute a(n)____________________ recursive function on a


computer,the function executes until the system runs out of memory.

Q3) The collating sequence of A in the ASCII character set is


____________________.

Q4) The ____________________ bit of 33 is 1.


Page 17
To view all questions and flashcards with answers, click on the resource link above.
Chapter 16: Linked Lists
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5319

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

Q6) A(n)____________________ is an object that produces each element of a


container,such as a linked list,one element at a time.

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

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

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.

Q5) A comparison tree is a(n)____________________ tree.

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.

Q4) Duplicates are allowed in a binary search tree.


A)True
B)False

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

Q2) Linked lists cannot be used to implement an adjacency list.


A)True
B)False

Q3) An edge incident on a single vertex is called a(n)____.


A) block
B) cycle
C) component
D) loop

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

Q5) A graph is ____________________ if the number of vertices is zero.


Page 22
To view all questions and flashcards with answers, click on the resource link above.
Chapter 21: Standard Template Library (STL)
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/5324

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

Q3) ____ is a nonmodifying algorithm.


A) equal
B) copy
C) fill
D) sort

Q4) A container's ____ executes when the object goes out of scope.
A) default constructor
B) destructor
C) copy constructor
D) iterator

Q5) The associated header file of the sequence container multimap is


____________________.

Q6) The term ____________________ stands for double-ended queue.

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

You might also like