गुरुर्ब्रह्मा गुरुर्विष्णु गुरुर्देवो महेश्वरा गुरुर्साक्षात परब्रह्म तस्मै श्री गुरवे नमः !
Quiz 1: Orientation Quiz
Q1. This course includes ____ weekly modules.
5
6
7
8
SOLUTION-5
Q2. I am required to purchase a textbook for this course.
False
True
SOLUTION-False
Q3. of the following activities are required to pass the course?
Complete the weekly homework.
Complete the programming assignment.
Complete the Final Exam.
All the above options
SOLUTION-All the above options
Q4. The following tool(s) will help me use the discussion forums:
Upvoting posts
Reporting inappropriate posts
Following a thread
All of the other options are correct.
SOLUTION-All of the other options are correct.
Q5. If I have a problem in the course I should:
Email the instructor
Call the instructor
Drop the class
Report it to the Learner Help Center (if the problem is technical) or to the Content Issues forum (if the problem is an error in the course materials).
SOLUTION-Report it to the Learner Help Center (if the problem is technical) or to the Content Issues forum (if the problem is an error in the course materials).
Total points 25
100
80
85
77
SOLUTION-85
Question 2 The value of 5*3*2 is _____. 1 point
15
30
50
8
SOLUTION-30
Question 3 The value of 5^252 + 3^232 + 77^2772 + 10^2102 is _____. 1 point
7700
95
190
6063
SOLUTION-6063
Question 4
The value of 1+2+3+4+5+6+7+8+9+10 is _____. 1 point
77
11
Some very large number
55
SOLUTION-55
Question 5
The value of 21+22+23+24+25 is _____. 1 point
127
126
125
62
SOLUTION-62
Question 6
In a queue data structure, the following items are inserted in the following order: Bob, Alice, Charlie, Eve, Zebra. Then an item is removed from the queue. That item will be _____. 1 point
None - this will be an error
Eve
Bob
Charlie
SOLUTION-Eve, Bob
Question 7
In a queue data structure, the following items are inserted in the following order: Bob, Alice, Charlie, Eve, Zebra. Then three items are removed from the queue. Then two further items are inserted: Yelp, Pinion. Then two more items are removed from the queue. The next item removed will be _____. 1 point
None - this will be an error
Charlie
Yelp
Alice
SOLUTION-Charlie
Question 8
In a stack data structure, the following items are inserted in the following order: Bob, Alice, Charlie, Eve, Zebra. Then an item is removed from the stack. That item will be _____. 1 point
None - this will be an error
Zebra
Alice
Eve
SOLUTION-Zebra
Question 9
In a stack data structure, the following items are inserted in the following order: Bob, Alice, Charlie, Eve, Zebra. Then three items are removed from the stack. Then two further items are inserted: Yelp, Pinion. Then two more items are removed from the stack. The next item removed will be _____. 1 point
Charlie
Pinion
Alice
Eve
SOLUTION-Alice
Question 10
You write a C++ program and it’s in two files: myprogram.h, and myprogram.cpp. Then a “process” is _____.1 point
The two C++ files myprogram.h and myprogram.cpp
The compiled version (executable) of this program in action, with stack, heap, registers, code, program counter, etc.
Any object (.o) files created when this program is compiled
The executable file created when this program is compiled
SOLUTION-The compiled version (executable) of this program in action, with stack, heap, registers, code, program counter, etc.
Question 11
Which of the following in a process typically DOES NOT change its value or contents over the lifetime? 1 point
Program counter
Code
Stack
Heap
SOLUTION-Code
Question 12
For an executing process, which of the following actually executes the instructions of the process? 1 point
CPU
Cache
Disk
Memory
SOLUTION-CPU
Question 13
The CPU can access data stored in different levels of the memory hierarchy. Which of these is the fastest to access?
1 point
Cache
SSD
Registers
Main Memory (RAM)
SOLUTION-SSD
Question 14
In an executing process, the program counter points __________. 1 point
To the bottom of the stack
To the beginning of the method/function that is currently being executed
To the currently-being-executed line number of the C++ program you wrote
To the currently-being-executed line number of low-level (e.g., machine-level) program derived by compiling the C++ program you wrote
SOLUTION-To the currently-being-executed line number of low-level (e.g., machine-level) program derived by compiling the C++ program you wrote
Question 15
Searching for an element in an unsorted array (or vector) of N elements takes time _____. 1 point
O(N)
O(1)
O(N/2)
O(N2)
SOLUTION-O(N/2)
Question 16
Insertion sorting of an unsorted array of size N takes time _____. 1 point
O(1)
O(N2)
O(N3)
O(N)
SOLUTION-O(N2)
Question 17
You are given an array (vector) of N integers that is sorted in increasing order. You are asked to create a sorted list of the same integers but in decreasing order. You can use any extra arrays, and creating extra arrays takes O(1) time. The most efficient algorithm to achieve this takes time ______. 1 point
O(N/2)
O(1)
O(N)
O(N2)
SOLUTION-O(N)
Question 18
An algorithm to process a set of N elements takes time (in microseconds) = f(N) = 0.03*N3+1000*N+3. This algorithm is _____. 1 point
None of these
O(N2)
O(N3)
O(N) because 1000 is the highest constant
SOLUTION-O(N3)
Question 19
You are given a bag with 10 balls, of which 3 are red, 3 are blue, 1 is yellow, 2 are black, and 1 is white. You pick one ball at random from the bag. The probability that this ball is black is _____. 1 point
0
1
1/5
1/10
SOLUTION-1/5
Question 20
You are given a bag with 10 balls, of which 3 are red, 3 are blue, 1 is yellow, 2 are black, and 1 is white. You pick one ball, note its color, put the ball back in the bag, and then pick another ball. The probability that it was the case that the first ball was black and the second ball was red is _____. 1 point
0.06
0.111
None of these
1
SOLUTION-0.06
Question 21
Someone claims that the big O notation does not make sense at all, and they give the following example. An algorithm A that processes an input set of N elements takes time, in seconds, given by T(N) = 10000*N + 0.00001*N^3. They say that the large constant (10000) associated with the N will always dominate over the small constant (0.00001) associated with the N^3. You say that this algorithm A is _____.Confusing
O(N)
O(N3)
O(1)
SOLUTION-O(N3)
Question 22
Someone writes the following piece of code. What is its Big O complexity? 1 point
int k=0;
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
k++;
}
}
O(N)
None of these
O(1)
O(N2)
SOLUTION-None of these
Question 23
You are given the following graph. In this graph, each edge has a weight that denotes the time taken to move between those cities (in hours). A “path” is defined as a sequence of edges that can be joined together to create, well, a path from a source node to a destination node. For instance, one path from node E to node D goes like: E to B to C to D. The “path cost” is obtained by adding up the costs of all its constituent edges – for the above example, the path’s cost is 9 + 2 + 4 = 15. There might be multiple paths between a pair of source, destination nodes. Among all these paths, we say that “shortest path” between a source and destination node pair is that path which has the lowest path cost.
Answer the following question: the shortest path that goes from node A to node C passes via which sequence of nodes? 1 point
Direct edge from A to C
A to B to C
None of these
A to D to C
SOLUTION-A to B to C
Question 24
In the following graph, the shortest path that goes from node D to node E has what cost? 1 point
17
28
14
There is not enough information to answer this question.
SOLUTION-17
Question 25
In a graph containing N nodes, an edge can only join a pair of nodes. The maximum number of edges that can be present in this graph is best described as _____. 1 point
O(N3)
O(N4)
O(N)
O(N2)
SOLUTION-O(N2)