Font size
WorksheetsUTSDSA
Total questions: 100
Worksheet time: 2hrs 40mins
It is a specialized way of storing and organizing data in a computer so that it can be used efficiently.
Data Structure
Data Type
Variables
It is a step by step process to solve a given problem. Take the simplest example below.
Pseudo code
Programming
Algorithm
It is a measure of how well a computer algorithm scales as the amount of data involved increases.
Big logN Notation
Big X Notation
Big O Notation
In this type of search, a sequential search is made over all items one by one.
Search
Binary Search
Linear Search
It is the process of arranging a list of elements in a particular order.
Search
Sorting
Elements
2. _________________ is a collection of elements used to store the same type of data.
Array
Switch
Case
Loop
6. Which of the following is the correct operator to compare two variables?
equal
=
:=
==
A queue is a _________ data structure in which each element that was inserted first is the first one to be taken out.
FITO
FIFO
FISO
FIVO
_________ operation removes the element from the top of the stack.
push
pop
update
none of the above
_________ operation adds an element to the top of the stack.
pop
push
peep
all of the above
Full form of LIFO is ____________
Last Inside First Outside
Last Innner First Outer
Last In First Out
Last Impact First Out
Stack uses __________ data structure as the element that was inserted last is the first one to be taken out.
LIPO
FIFO
LIFO
FIPO
____________data structures are those whose sizes and structures associated memory locations are fixed at compile time.
linear
homogeneous
static
dynamic
In ____________ data structure, the data items are arranged in a linear sequence.
linear
non linear
both a and b
all of above
_____________ specifies how we enter data into our programs and what type of data we enter.
data type
data
datum
all of above
People have used the word ________ to mean computer information that is transmitted or stored.
Beta
Data
Database
None of above
In linked list each node is divided into ___________parts?
one
two
three
four
Which data structure allows deleting data elements from front and inserting from rear?
Stack
Queue
Array
Linked List
The disadvantage in using a circular linked list is __________
it is possible to get into infinite loop
last node points to fist node.
time consuming
requires more memory space.
In a Queue Data Structure...
New elements may only be added to the end of the queue
Elements may only be retrieved from the front of the queue.
Elements may only be retrieved from the end of the queue.
New elements may only be added to the front of the queue
Select operations that can be performed on a Queue Data Structure...
isEmpty()
pop()
push()
isFull()
Append(Item)
What is the starting index of items in an array in most programming languages?
Index 1
Index 0
Index -1
Index 10
Linked List is dynamic in nature
The correct number stack of (4 + 6) * 3 is…
Which real-life example represents a queue?
Stack of dishes in the kitchen
Queue of customers at cashier
A list of phone contacts
File storage
If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, in what order will they be removed?
ABCD
DCBA
DCAB
ABDC
circular linked list
linked list
doubly circular linked list
doubly linked list
Figure Speak
Processing box
Start/stop box
Input / Output box
Decision / condition box
Figure Speak
Input / Output box
Start/stop box
Decision / condition box
Processing box
Figure Speak
Processing box
Input / Output box
Start/stop box
Decision / condition box
It is used for accepting input or giving output of the program.
It is used for writing the processing instructions and doing calculations.
Which algorithm matches this description: "a sorting algorithm that treats the input as two parts, a sorted part and an unsorted part, and repeatedly selects the proper next value to move from the unsorted part to the end of the sorted part."
Selection Sort
Radix Sort
Insertion Sort
Binary Sort
Which algorithm matches the description: "is an efficient algorithm for finding an item from a sorted list of items. It works by repeatedly dividing in half the portion of the list that could contain the item, until you've narrowed down the possible locations to just one."
Linear Search
Binary Search
Bubble Search
Straight Search
What is the degree of complexity ( Big O() ) of the linear search algorithm?.
O(nn)
O(n log 2)
O(n2)
O(n)
What is a disadvantage of the binary search algorithm?
The elements to search needs to be sorted first.
The elements to search do not have to be sorted
Difficult to understand and implement
It uses recursion
What is the correct statement about selection sort?.
Can sort alphabetically, and numerically (ascending or descending)
Can only sort numeric (ascending or descending)
Can only sort alphabetically
None of the above
What is a disadvantage of the bubble sort algorithm?
Easy to understand and implement
It is inefficient due to the number of exchanges.
This makes it slow for large arrays
Sometimes it does not work
Elements need to be sorted in order to be used.
What is the degree of complexity ( Big O() ) for the Bubble sort algorithm?.
O(n2)
O(n)
O(2n)
O(N log 2)
Which of the following best describes a characteristic of a good algorithm?
It should be complex and lengthy
It should be efficient and clear
It should be ambiguous
It should be difficult to understand
Which of the following best represents the correct algorithm for cooking instant noodles?
Boil water → Put noodles → Add seasoning → Stir → Serve
Put noodles → Add seasoning → Boil water → Stir → Serve
Add seasoning → Stir → Boil water → Put noodles → Serve
Serve → Add seasoning → Put noodles → Boil water → Stir
Which of the following best represents the algorithm for making a cup of tea?
Pour hot water → Put tea bag → Add sugar → Stir
Stir → Pour hot water → Add sugar → Put tea bag
Add sugar → Stir → Put tea bag → Pour hot water
Put tea bag → Stir → Add sugar → Pour hot water
Which of these is the best description of a list in Python?
A list is a collection of data that has an order and can be changed
A list is a lot of variables
A list is used for shopping
A list is a collection of data that cannot hold duplicated data and cannot be changed
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Jesse, John, Harry, Harry
nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList = [John, Harry, Jesse, John, Harry, Harry]
Which of these pieces of code would return the name "Harry" from the following list?
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList()
nameList[1]
NameList(4)
nameList["4"]
quiz = {"Do you help out at home? ":"yes",
"Do you beleive in Santa? ":"yes"}
Which of the following methods is used to add an element to the end of a list in Python?
`insert()`
`append()`
`extend()`
`add()`
Apa nama data type dalam Python yang digunakan untuk menyimpan data teks?
String
Boolean
Numeric
Sequence
Apa nama data type dalam Python yang digunakan untuk menyimpan data logika?
String
Boolean
Numeric
Sequence
Apa yang dimaksud dengan function di Python?
Kategori yang menentukan jenis, nilai, dan operasi pada data
Struktur yang menentukan cara menyimpan, mengatur, dan mengakses data
Fungsi yang menentukan input, output, dan proses yang dilakukan pada data
Ekspresi yang menentukan kondisi, perbandingan, dan logika pada data
Bagaimana cara membuat regular function di Python yang menerima dua argumen x dan y dan mengembalikan hasil penjumlahan keduanya?
def (x + y): return x, y
def add(x + y): return x, y
def (x, y): return x + y
def add(x, y): return x + y
How do you remove an item from a list in Python?
Using the pop() method.
Using the discard() method.
Using the delete() method.
Using the remove() method.
people = ["John", "Rob", "Bob"]
print (people[1])
what would this result be?
people = ["John", "Rob", "Bob"]
print (people[4])
what would this result be?
A data type than can have one of two values: True or False
boolean
variable
modulo
interpreter
What is a variable?
Step by step instructions to solve a problem
A location in memory that stores a value, and that value can change
A set of rules
A location in memory that stores a value, and that value cannot change
What is this code an example of:
IF length of password <= 6 THEN
print(“Password is too short.”)
ELSE
print(“password is valid.”)
ENDIF
Selection
Iteration
Sequence
This code uses which construct?
x = 0
WHILE x < 5
print(x)
x = x + 1
END WHILE
Sequence
Selection
Iteration
What keyword indicates that it is a function and not a procedure?
RETURN
INT
DEF
Is this a function or a procedure?
Function
Procedure
Sequence is when...
...instructions are executed one after another
instructions are executed one after another in a series
instructions are executed by the user
instructions are executed one after another but not always in series
Selection is when...
...a program will execute instructions regardless of what the user does
...a program will execute certain instructions based on the user's actions
...a program will execute certain instructions based on conditions
....a program will execute all instructions regardless of what the user does
Selection statements include...
IF, THEN, ELSE & CASE
IF, ELSE, & CASE
IF, THAN, ELSE & CASE
IF, THEN, ELSE, ELIF & CASE
In computer programming 'iteration' is used to...
... loop around and around a piece of code until the correct answer is chosen
...loop around a piece of code until a condition is met that activates the next part of the program
...loop around and around a piece of code until a condition is met that ends the iteration
...loop twice around a piece of code until a condition is met that ends the iteration
Choose the conditional operator for not equal to:
==
=!
<>
!=
What are the three components of any algorithm?
Time Complexity, Memory Usage, Recursion
Start, Middle, End
Variables, Functions, Loops
Input, Process, Output
_____ is an algorithm that treats a list as two parts, a sorted part and an unsorted part, and repeatedly inserts the next value from the unsorted part into the correct location in the sorted part.
Selection sort
Insertion sort
Merge sort
Quick sort
What is the runtime complexity of selection sort?
0(NlogN)
0(logN)
0(N2)
0(N)
Which of the following lists are sorted in ascending order?
[‘apple’, ‘apricot’, ‘avocados’]
[‘bananas’, ‘Boysenberries’, ’blueberries’]
[‘cherries’, ‘crab apples’, ‘cantaloupes’]
[‘drew berries’, ‘dates’, ‘damson plum’]
When you read code carefully to look for errors and fix them
debug
fix
try again
mistake
Notes that explain to others what each part of your program does.
code
comment
notes
plan
The rules for correct spelling, grammar, and punctuation in a programming language
while true loop
method
syntax
algorithm
3)A_____ in python that is used to define numbers.
a) Integer
b) Boolean
c) Float
d) String
7)What data type is the object below?
L = [1, 23, 'hello', 1]
a) list
b) dictionary
c) array
d) tuple
18)Read the Python program below:
a = 13
print(2*a)
print(a)
When this program is run, what will be displayed on the screen?
a)13 26
b)Line 3 will not be executed
c)13
d)26
Which term describes the process of hiding the complexity of a system while exposing only the necessary parts?
A) Encapsulation
B) Abstraction
C) Inheritance
D) Polymorphism
What would the next of the last node of a circular linked list return?
head
tail
null
none of the above
What advantage does a linked list have over an array?
A linked list can give you the data faster
It is easier to use
A linked list is not of a fixed size
It's better
Circular Linked List will be
Only Singly
Only Doubly
Singly and Doubly
None
Array Comes under
Linear Data Structures
Non - Linear Data Structures
Primitive Data Structures
None of the Above
A linear dynamic data structure to store data items is called
Linked list
Stack
Tree
Queue
Two dimensional arrays are also known as ______________
Subscripts
Matrices
ndarray
Vectors
How do you access the third element in an array named 'arr'?
arr[2]
arr(2)
arr[3]
arr.third()
What method is used to add an element to the end of an array in Python?
The insert() method is used to add an element to the end of an array in Python.
The pop() method is used to add an element to the end of an array in Python.
The remove() method is used to add an element to the end of an array in Python.
The append() method is used to add an element to the end of an array in Python.
What method is used to sort the elements of an array in Python?
organize()
sort()
order()
arrange()
Apa perbedaan utama antara array dan list di Python?
Array bersifat dinamis, list bersifat statis
Array hanya dapat menyimpan satu tipe data, list lebih fleksibel
Array tidak memiliki indeks, list memiliki indeks
Array dapat menyimpan berbagai tipe data, list tidak bisa
Apa fungsi len() pada list?
Menghitung jumlah elemen dalam list
Mengurutkan elemen list
Menambah panjang list
Mengubah ukuran list
Which of these statements is true for a linear search?
The algorithm only searches for 0 or 1
The data must be sorted in order
It is very inefficient for large data sets
It is very inefficient for small data sets
