

Programming Languages Concepts
Exam Answer Key

Course Introduction
Programming Languages Concepts is a comprehensive course designed to introduce students to the fundamental principles underlying the design, implementation, and application of programming languages. The course explores a variety of language paradigms, including procedural, object-oriented, functional, and logic programming. Topics include syntax and semantics, data types, control structures, scoping rules, memory management, and language translation. Through comparative analysis and practical exercises, students deepen their understanding of how programming languages work, enabling them to make informed decisions when selecting and using languages for software development projects.
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) The ASCII data set consists of ____________________ characters.
Answer: 128
Q2) When the power is switched off,everything in ____ is lost.
A) main memory
B) secondary storage
C) hard disks
D) floppy disks
Answer: A
Q3) ____ represent information with a sequence of 0s and 1s.
A) Analog signals
B) Application programs
C) Digital signals
D) System programs
Answer: C
Q4) The ____________________ monitors the overall activity of the computer and provides services such as memory management,input/output activities,and storage management.
Answer: operating system
OS

Page 3
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) The memory allocated for a float value is ____ bytes.
A) two
B) four C) eight
D) sixteen
Answer: B
Q2) In C++,you can use a(n)____________________ to instruct a program to mark those memory locations in which data is fixed throughout program execution.
Answer: named constant constant
Q3) A(n)____________________ is a collection of statements,and when it is activated,or executed,it accomplishes something.
Answer: subprogram sub program sub-program function modlue
Q4) The maximum number of significant digits is called the ____________________.
Answer: precision

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

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) The extraction operator >> skips only all leading blanks when searching for the next data in the input stream.
A)True
B)False
Answer: False
Q2) Suppose that alpha,beta,and gamma are int variables and the input is:
100 110 120
200 210 220
300 310 320
What is the value of gamma after the following statements execute? cin >> alpha; cin.ignore(100,'\n'); cin >> beta; cin.ignore(100,'\n'); cin >> gamma;
A) 100
B) 200
C) 300
D) 320
Answer: C
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) A ____________________ operator allows you to make comparisions in a program.
Q2) The expression in an if statement is sometimes called a(n)____.
A) selection statement
B) action statement
C) decision maker
D) action maker
Q3) In C++,&& has a higher precedence than ||.
A)True
B)False
Q4) Suppose found = true and num = 6.The value of the expression (!found)|| (num > 6)is
A)True
B)False
Q5) The value of the expression 7 + 8 <= 15 is ____________________. A)True
B)False
Q6) A(n)____________________ structure does not require the evaluation of a logical expression.
Q8) The symbol > is a(n)____________________ operator. Page 6
Q7) Every else must be paired with a(n)____________________.
To view all questions and flashcards with answers, click on the resource link above.
Page 7

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) Assume that all variables are properly declared.The following for loop executes 20 times.
for (i = 0; i <= 20; i++)
\(\quad\)cout << i;
A)True
B)False
Q2) Suppose sum,num,and j are int variables,and the input is 4 7 12 9 -1.What is the output of the following code?
cin >> sum;
Cin >> num;
For (j = 1; j <= 3; j++)
{ \(\quad\)Cin >> num;
\(\quad\)Sum = sum + num;
}
Cout << sum << endl;
A) 24
B) 25
C) 41
D) 42
To view all questions and flashcards with answers, click on the resource link above.
Page 8

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) Given the following function prototype: int myFunc(int,int);,which of the following statements is valid? Assume that all variables are properly declared.
A) cin >> myFunc(y);
B) cout << myFunc(myFunc(7, 8), 15);
C) cin >> myFunc('2', '3');
D) cout << myFunc(myFunc(7), 15);
Q2) The heading of the function is also called the ____.
A) title
B) function signature
C) function head
D) function header
Q3) A function ____________________ is a function that is not fully coded.
Q4) The program that tests a function is called a(n)____________________ program.
Q5) What value is returned by the following return statement? int x = 5;
Return x + 1;
A) 0
B) 5
C) 6
D) 7
Q6) In C++,:: is called the ____________________.
To view all questions and flashcards with answers, click on the resource link above. Page 9

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) In C++,[] is called the array subscript operator.
A)True
B)False
Q2) The data type string has a named constant,____,associated with it.
A) string::size
B) string::size_type
C) string::pos
D) string::npos
Q3) The following statement creates an anonymous type: enum {1ST,2ND,3RD,4TH} places;
A)True
B)False
Q4) The general syntax for accessing a namespace member is: namespace_name->identifier.
A)True
B)False
Q5) Suppose str = "ABCDEFG".The output of the statement cout << str.length()<< endl; is ____________________.
10
Q6) The values in the domain of an enumeration type are called
To view all questions and flashcards with answers, click on the resource link above. Page 11

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) Consider the statement int list[10][8];.Which of the following about list is true?
A) list has 10 rows and 8 columns.
B) list has 8 rows and 10 columns.
C) list has a total of 18 components.
D) list has a total of 108 components.
Q2) The function ____________________ returns the length of the string s,excluding the null character.
Q3) Assume you have the following declaration char nameList[100];.Which of the following ranges is valid for the index of the array nameList?
A) 0 through 99
B) 0 through 100
C) 1 through 100
D) 1 through 101
Q4) The following statement creates alpha to be a two-dimensional array with ____________________ rows. int alpha[10][25];
Q5) The word ____________________ is used before the array declaration in a function heading to prevent the function from modifying the array.
To view all questions and flashcards with answers, click on the resource link above. Page 12

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) The components of a struct are called the ____ of the struct.
A) variables
B) identifiers
C) elements
D) members
Q2) 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 correctly initializes the component length of bigRect?
A) bigRect = {10};
B) bigRect.length = 10;
C) length[0]= 10;
D) bigRect[0]= 10
Q3) Arrays are passed by ____________________ only.
To view all questions and flashcards with answers, click on the resource link above.
Page 13

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) Consider the accompanying class and member functions definitions in Figure 3.How many constructors are present in the class definition above?
A) none
B) one
C) two
D) three
Q2) In C++,you can pass a variable by reference and still prevent the function from changing its value by using the keyword ____ in the formal parameter declaration.
A) automatic
B) private
C) static
D) const
Q3) A ____ sign in front of a member name on a UML diagram indicates that this member is a public member.
A) +
B) -
C) #
D) $
To view all questions and flashcards with answers, click on the resource link above. Page 14
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 the case of composition,the ____________________ name is used to invoke the constructor.
Q2) Suppose that bClass is a class.Which of the following statements correctly derives the class dClass from bClass?
A) class dClass:: public bClass
//classMembersList
B) class dClass: private bClass { //classMembersList
C) class dClass:: protected bClass { //classMembersList
D) class bClass: public dClass
//classMembersList

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

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) Variables that are created during program execution are called static variables.
A)True
B)False
Q2) What is the output of the following code?
int *p;
Int x;
x = 12;
p = &x;
cout << x << ",";
*p = 81;
Cout << *p << endl;
A) 12, 12
B) 12, 81
C) 81, 12
D) 81, 81
Q3) The ____________________ of a base class automatically makes the destructor of a derived class virtual.
Q4) A pointer variable is a variable whose content is a memory address.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 16

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) 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
Q2) In C++,operator is a reserved word.
A)True
B)False
Q3) The associativity of the operator = is from right to left.
A)True
B)False
Q4) When an object invokes a member function,the member function references the pointer ____ of the object.
A) object
B) it
C) this D) address
Q5) Classes with pointer member variables must include the ____________________ constructor.
Q6) The operators that cannot be overloaded are .,.*,::,?:,and
To view all questions and flashcards with answers, click on the resource link above. Page 17

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) When an exception is thrown,if the program does not handle the exception,then the function ____ is called to terminate the program.
A) log
B) what
C) terminate
D) close
Q2) If the operator new cannot allocate memory space,this operator throws a(n)____________________ exception.
Q3) If you want to include members in your exception class,you typically include the function ____.
A) that
B) this
C) log
D) what
Q4) In C++,any class can be considered an exception class.
A)True
B)False
Q5) A(n)____________________ block specifies the type of exception it can catch and contains an exception handler.
To view all questions and flashcards with answers, click on the resource link above. Page 18

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) In a recursive function,the base case stops the recursion.
A)True
B)False
Q2) Consider the accompanying definition of a recursive function.What is the output of the following statement? cout << recFunc(8)<< endl;
A) 4
B) 8
C) 72
D) 720
Q3) 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
Q4) The language of a computer,called ____________________ language,is a series of 0s and 1s.
Q5) The fourth Fibonacci number in a sequence is the sum of the ____________________ Fibonacci numbers.
To view all questions and flashcards with answers, click on the resource link above. Page 19

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) 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) Which of the following statements appears in the insert function of a doubly linked list?
A) current++;
B) trailCurrent++;
C) newNode++;
D) count++;
Q3) You can use the pointer head of a linked list to traverse the list.
A)True
B)False
Q4) A linked list in which the last node points to the first node is called a(n)____________________ linked list.
Q5) In a circular linked list with more than one node,it is convenient to make the pointer first point to the ____________________ node of the list.
Q6) A linked list must be searched ____________________,starting from the first node.
To view all questions and flashcards with answers, click on the resource link above. Page 20

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) If you try to add a new item to a full stack,the resulting condition is called a(n)____.
A) override
B) overflow
C) overload
D) underflow
Q2) The expression a + b is the same in both infix notation and postfix notation.
A)True
B)False
Q3) A technique in which one system models the behavior of another system is called
A) imitation
B) recursion
C) simulation
D) stimulation
Q4) In the array representation of a stack,if a value called stackTop indicates the number of elements in the stack,then stackTop-1 points to the top item of the stack.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 21

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) A sequential search of an n-element list takes ____ key comparisons if the item is not in the list.
A) 0
B) n/2
C) n
D) n<sup>2</sup>
Q2) 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
Q3) The swap function of quick sort is written differently from the swap function for selection sort.
A)True
B)False
Q4) During the second iteration of a selection sort,the smallest item is moved to the top of the list.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 22

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) Let T be a binary search tree with n nodes,in which n > 0.The number of key comparisons is approximately O(____________________).
Q2) In a binary tree,the branches go only from a child to a parent.
A)True
B)False
Q3) When traversing a binary tree with the pointer current,the pointer current is initialized to ____.
A) NULL
B) llink
C) rlink
D) root
Q4) The sequence of operations in a postorder traversal is ____.
A) traverse left; traverse right
B) traverse left; traverse right; visit
C) visit; traverse left; traverse right
D) traverse left; visit; traverse right
Q5) Duplicates are allowed in a binary search tree.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 23

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) A(n)____________________ ordering of the vertices of the accompanying graph is 0,1,3,4,2,5,7,8,6,9.
Q2) A graph might have cycles; therefore,we might not be able to traverse the entire graph from a single vertex.
A)True
B)False
Q3) A(n)____________________ graph G is called strongly connected if any two vertices in G are connected.
Q4) Linked lists cannot be used to implement an adjacency list.
A)True
B)False
Q5) A graph is ____________________ if the number of vertices is zero.
Q6) A maximal subset of connected vertices is called a ____ of G.
A) cycle
B) union
C) subset
D) component
Q7) ____________________ algorithm builds the tree iteratively by adding edges until a minimal spanning tree is obtained.
To view all questions and flashcards with answers, click on the resource link above. Page 24

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 stack container class,inserts a copy of item onto the stack.
Q2) ____________________ predicates check a specific property for a pair-that is,two arguments.
Q3) List containers are implemented as doubly ____________________.
Q4) The ____ operation removes the first element from the deque object deq.
A) deq.front()
B) deq.push_front()
C) deq.pop_front()
D) deq.push()
Q5) Every container contains the typedef ____________________.An iterator of this type is used to iterate through the elements of a container in reverse.
Q6) 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.
Q7) ____________________ iterators are forward iterators that can also iterate backward over the elements.
Q8) The term ____________________ stands for double-ended queue.
Page 25
Q9) ____________________ predicates check a specific property for a single argument.
To view all questions and flashcards with answers, click on the resource link above. Page 26