Font size
WorksheetsDSA Quiz # 1
Total questions: 50
Worksheet time: 57mins
A series of values stored in memory is called ___
an array
a tree
a matrix
a struct
Almost all programming languages start arrays at ___
index 0
index 1
index 2
the null character
Arrays of characters, like letters, numbers, punctuation and other written symbols, are called ___
structs
vectors
strings
groups
int nums[ ] =
{2, 3, 5, 8, 9, 11};
How would you access the fourth element in nums
nums[8]
nums[3]
nums(4)
nums(3)
Which of these is not a data structure?
Stack
Array
Integer
List
Data Structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.
True
False
Based on the following statements, which are the leaf nodes?
ArrayList<Integer> minHeap = new ArrayList<>();
Collections.addAll(minHeap, 2, 4, 5, 7, 8);
5, 7, and 8
4, 5, and 7
2, 4, and 5
7 and 8
Set A = { 1, 3, 5, 7 }
Set B = { 2, 3, 4, 5 }
The difference of sets A and B (A - B) is _______?
{ 3}
{ 5 }
{ 1, 7 }
{ 3, 5}
Are basic data structures provided by programming languages to represent single values, such as integers, floating-point numbers, characters, and booleans.
(a)
are higher-level data structures that are built using primitive data types and provide more complex and specialized operations.
(a)
set of step-by-step instructions to solve a given problem or achieve a specific goal.
(a)
A data structure is not worth much if you cannot search through it or manipulate it efficiently using algorithms, and the algorithms. TRUE/ FALSE
TRUE
FALSE
is about finding efficient ways to store and retrieve data, to perform operations on data, and to solve specific problems. TRUE/ FALSE
TRUE
FALSE
DSA are used in virtually every software system, from operating systems to web applications. TRUE/ FALSE
TRUE
FALSE
A measure of the amount of time an algorithm takes to run, depending on the amount of data the algorithm is working on.
(a)
This measure of the amount of memory an algorithm uses, depending on the amount of data the algorithm is working on.
(a)
A mathematical notation that describes the limiting behavior of a function when the argument tends towards a particular value or infinity. Used in this tutorial to describe the time complexity of an algorithm.
(a)
A programming technique where a function calls itself.
(a)
A method of solving complex problems by breaking them into smaller, more manageable sub-problems, solving the sub-problems, and combining the solutions. Recursion is often used when using this method in an algorithm.
(a)
A simple and straight forward way an algorithm can work by simply trying all possible solutions and then choosing the best one.
(a)
are very useful for introducing algorithms.
(a)
What is the output of this program?
0
1
120
None of the above
What is the returned value of recMethod(5)?
What is returned as a result of the call mystery(4,6)?
What is the output of this program?
24
30
120
720
What is the action of method mystery2?
a+b
a*b
ab
ba
a!
What is printed as a result of the call stringMaker("COMPSCI")?
COMPSC
COMPS
COMP
COM
CO
C
OMPSCI
MPSCI
PSCI
SCI
CI
I
COM
COMP
COMPS
COMPSC
COMPSCI
CO
COM
COMP
COMPS
COMPSC
COMPSCI
Which expression represents the result of calling recurs(11,4)?
Which of the following is the best definition of a recursive method?
What value is returned as a result of the call mysterious(x)?
What does the following code segment print?
5 4 3 2 1
-5 -4 -3 -2 -1
-4 -3 -2 -1 0
How many times does the following method print a *?
9
6
7
10
What does the code print?
1 2 3 4
1 2 3 4 5
0 1 2 3 4
0 1 2 3 4 5
What is printed when the code segment is executed?
0 2 4 6 8 10 12 14 16 18
0 6 12 18
1 4 7 10 13 16 19
4 10 16
What will the output of the following code segment be?
int a = 1, b = 2;
System.out.println(++a+”,”+b++);
1,2
2,2
2,3
3,3
What will the following program segment display?
for(int a = 2; a <= 10; a += 3)
System.out.print(a+””);
2 5 8
2 5
2 5 8 11
2
This expression is executed by the for loop only once, regardless of the number of iterations.
a. initialization expression
b. test expression
c. update expression
d. preincrement expression
This statement causes a loop to terminate early.
a. continue
b. break
c. switch
d. none of the above
This type of loop has no way of ending and repeats until the program is interrupted.
a. indeterminate
b. interminable
c. infinite
d. timeless
The while loop is this type of loop.
pretest
posttest
prefix
postfix
Java is a
Procedure Oriented Language
Structure Oriented Language
Object_Oriented Language
Machine Language
Java program does not run without below function
user()
system()
main()
void()
A ___________ file is created after successful compilation of a Java program.
Object file
Array file
Class file
String file
JDK stands for
Java Developer Kit
Java Development Kit
Java Design Kit
Java Debugging Kit
The name of the following should be the file name in Java
Object Name
Variable Nam
Class Name
Array Name
In total, how many times is the inner loop executed?
5
10
15
50
Infinite Loop
