CUET EXAM Computer Science Previous Year Questions Set 1
CUET Computer Science Set 1
(i) Which out of the following is not the application of stacks ?
(1) Parenthesis balancing
(2) Tracking of local variable at run time
(3) Analyzer for compiler syntax
(4) Transfering of data between two asynchronous processes
Solution :
(4) Transfering of data between two asynchronous processes
Explanation: Transferring data between two asynchronous processes: This is not a
typical application of stacks. Asynchronous processes may use other
mechanisms like message passing or shared memory for data transfer,
rather than stacks.
(ii) It is taken that enteries that are made in stack are
considered "ordered". What does this imply?
(1) You can sort the collection of stack
(2) The enteries made in the stack can be compared by '<' operation
(3) Enteries made are sequential that is one by one
(4) Resource allocation in stack
Solution
(3) Entries made are sequential, that is, one by one.
Explanation: In a stack, elements are added or removed in a sequential manner,
following the Last In, First Out (LIFO) principle. Each new element is placed
on top of the stack, and removal also happens from the top. This sequential
ordering ensures that elements are processed in the order they were
added
(iii) Which one of the following is not related to stack?
(1) PUSH
(2) POP
(3) FIFO
(4) LIFO
Solution
(3) FIFO (First In, First Out)
Explanation: While FIFO is a principle associated with queues, which operate based on
the First In, First Out ordering, stacks operate on the Last In, First Out
(LIFO) principle
(iv) The postfix for a string is ABC+-D*, the actual string will be :
(1) (A-(B+C))*D
(2) ((A-B)+C)*D
(3) ((A+B)-C)*D
(4) (A+(B-C))*D
Solution
(1) (A-(B+C))*D
(v) The operation is used to insert a new element at the front of
the deque.
(1) InsertRear
(2) InsertFront
(3) DeletionFront
(4) DeletionRear
Solution
(2) InsertFront
(vi) Which of the following is not true about queue?
(1) It follows the principle of First In First Out (FIFO)
(2) It follows the First Came First Solved (FCFS) approach
(3) In queue most recent element will be the first one to delete
(4) In simple queue elements get added from the rear end
Solution
(3) In queue most recent element will be the first one to delete
(vii) For inserting value in stack the values are only inserted from
(1) TOP
(2) FRONT
(3) REAR
(4) NONE OF THE ABOVE
Solution
(1) TOP
(viii) Let us consider for an Algorithm A, a nested loop and also
a single loop is present what would be the time complexity for
algorithm A ?
(1) 1
(2) n
(3) n²
(4) n³
Solution
(3) n²
Explanation: If Algorithm A contains both a nested loop and a single loop, and
assuming the single loop iterates n times and the nested loop iterates m
times, the time complexity of Algorithm A would generally be expressed as:
O(n.m)
(ix) In bubble sort algorithm, every iteration through each
element of a list is called?
(1) Return
(2) Mate
(3) Pass
(4) Sort
Solution
(3) Pass
(x) Consider a list of elements 8, 7, 3, 4, 1, 9 and perform the
insertion sort in ascending order. Which of the following intermediate
list occur during sorting.
(A) 7, 8, 3, 4, 1, 9
(B) 7, 3, 8, 4, 1, 9
(C) 3, 4, 7, 8, 1, 9
(D) 7, 3, 4, 8, 1, 9
(E) 1, 7, 3, 4, 8, 9
Choose the correct answer from the options given below:
(1) (A) only
(2) (A), (D) and (E) only
(3) (B), (C) and (D) only
(4) (A), (B) and (C) only
Solution
(4) (A), (B) and (C) only
Explanation: To perform insertion sort on the given list [8, 7, 3, 4, 1, 9], let's walk through the sorting process:
1. Start with the list [8, 7, 3, 4, 1, 9].
2. Pick the second element (7) and insert it into its correct position relative to the first element (8). This gives [7, 8, 3, 4, 1, 9].
3. Now, pick the third element (3) and insert it into its correct position relative to the elements before it. This gives [3, 7, 8, 4, 1, 9].
4. Pick the fourth element (4) and insert it into its correct position. This gives [3, 4, 7, 8, 1, 9].
5. Pick the fifth element (1) and insert it into its correct position. This gives [1, 3, 4, 7, 8, 9].
6. Finally, the last element (9) is already in its correct position.
So, the intermediate lists are:
(A) 7, 8, 3, 4, 1, 9 (after the first pass)
(B) 7, 3, 8, 4, 1, 9 (after the second pass)
(C) 3, 4, 7, 8, 1, 9 (after the third pass)
(E) 1, 7, 3, 4, 8, 9 (after the fourth pass)
(xi) Which sorting algorithm works by continuously swapping
the adjacent elements ?
(1) INSERTION SORT
(2) SELECTION SORT
(3) BUBBLE SORT
(4) QUICK SORT
Solution
(3) BUBBLE SORT
Explanation: In Bubble Sort, during each pass through the list, adjacent elements are compared and swapped if they are in the wrong order, gradually "bubbling" the largest (or smallest, depending on the sorting order) elements to their correct positions.
(xii) Which two constraints when applied together will produce
a primary key constraint ?
(1) Primary key, Default
(2) Not NULL, Unique
(3) Unique, Default
(4) Primary key, Foreign key
Solution
(2) Not NULL, Unique
Explanation: The combination of "Not NULL" and "Unique" constraints when applied together will produce a primary key constraint.
(xiii) Which of the following statements are true ?
(A) Where condition in SQL can include aggregate functions.
(B) Having condition in SQL can include aggregate functions.
(C) SQL set operators tend to combine columns from two or more
tables.
(D) GROUP BY function is used to group rows of a table that contain
the same values in a specified column.
(E) Minus operator is also known as intersect operator.
Choose the correct answer from the options given below :
(1) (A) and (C) only
(2) (C) and (E) only
(3) (B) and (D) only
(4) (A), (C) and (E) only
Solution
(3) (B) and (D) only
Explanation: (A) Where condition in SQL can include aggregate functions.
- True. Aggregate functions like SUM(), AVG(), COUNT(), etc., can be used
in the WHERE clause to filter rows based on aggregated values.
(B) Having condition in SQL can include aggregate functions.
- True. The HAVING clause in SQL allows filtering of grouped rows based
on aggregate values, so it can include aggregate functions.
(C) SQL set operators tend to combine columns from two or more tables.
- False. SQL set operators like UNION, INTERSECT, and MINUS combine
rows from two or more queries or tables, not columns.
(D) GROUP BY function is used to group rows of a table that contain the
same values in a specified column.
- True. The GROUP BY clause is used to group rows based on the values
of a specified column or columns.
(E) Minus operator is also known as intersect operator.
- False. The MINUS operator in SQL is used to return all distinct rows from
the first query that are not present in the second query's result set. It is not
the same as the INTERSECT operator.
(xiv) HAVING clause in SQL is used to specify conditions on the
rows with
(1) where clause
(2) order by clause
(3) from clause
(4) Group by clause
Solution
(4) Group by clause
(xv) Which of the following is not an aggregate function of SQL
(1) PEEK()
(2) SUM()
(3) AVG()
(4) MIN()
Solution
(1) PEEK()
(xvi) Consider the following statements:
(A) Each attribute in a relation has a unique name
(B) All data values in an attribute must be from the same domain
(C) A special value NULL is used to represent values that are
unknown
(D) A database constraint allow different types of data to inserted into
the table
Choose the correct answer from the options given below :
(1) (A), (B) and (C) only
(2) (A), (B) only
(3) (A), (C), (D) only
(4) (A), (B), (C) and (D) only
Solution
(1) (A), (B) and (C) only
(xvii) The tuples within a relation must be
(1) Common
(2) Distinct
(3) Copy
(4) None
Solution
(2) Distinct
(xviii) Hard disk, SSD, CD/DVD, pendrive are examples of ______
devices.
(1) Input
(2) Output
(3) Storage
(4) Volatile
Solution
(3) Storage
(xix) Color = ['Red', 'Green', 'Blue', 'Pink', 'Yellow', 'Magenta',
'Black']
def longcolors(____, _____ ): # Fillline1
With __________:# Fillline2
__________: # Fillline3
__________: # Fillline4
__________: # Fillline5
fname = 'Color.txt'
n = int(input("Enter a number(4-7) :"))
________ # filline6
file = open(fname)
print(file.read())
Complete code for Filllinel and Fillline6 so that Fillline6 invoke the
longcolors functions by passing two arguments filename and integer
n.
(1) longcolors("colors", 5)
(2) def longcolors("colors", 5)
(3) def longcolors(n, frame):
longcolors(n, frame)
(4) def longcolors(frame, n)
longcolors(frame, n)
Solution
Color = ['Red', 'Green', 'Blue', 'Pink', 'Yellow', 'Magenta', 'Black']
def longcolors(filename, n): # Fillline1
with open(filename, 'w') as f: # Fillline2
for i in range(n): # Fillline3
f.write(Color[i] + '\n') # Fillline4
fname = 'Color.txt' # Fillline5
n = int(input("Enter a number(4-7) : ")) # filline6
longcolors(fname, n) # filline6
file = open(fname)
print(file.read())
(xx) MAC address is a physical or hardware address is a unique
value associated with a network adapter called NIC. MAC address is a
12-digit hexadecimal numbers shown as below:
FC:
CE: 78:16.
F8 AE:
IP address is a unique address that can be used to uniquely identify
each node in network IPV4 address looks like:
192: 1680:175
Based on above paragraph answer following question.
In MAC address later six digits represents:
(1) Unique Serial Number
(2) Organisational Unique Identifier
(3) NIC address
(4) Host Serial Number
Solution
he later six digits of a MAC address represent the Organizational Unique Identifier (OUI), identifying the manufacturer of the network interface card (NIC). Therefore, option (2) "Organisational Unique Identifier" is the correct Option.
(xxi) Which of the following statements is FALSE about keys in a relational
database?
(1) Any candidate key is eligible to become a primary key.
(2) A primary key uniquely identifies the tuples in a relation.
(3) A candidate key that is not a primary key is a foreign key.
(4) A foreign key is an attribute whose value is derived from the primary
key of another relation
Solution
(3) A candidate key that is not a primary key is a foreign key.
(xxii) What is the full form of MAC address ?
(1)Media Access Control
(2)Medrum Access Control
(3)Mobile Access Control
(4)Media Access Controller
Solution
(1)Media Access Control
(xxiii) How many bits in MAC and IP address have:
(1) 40, 32 bit
(2) 32, 48 bit
(3) 48, 32 bit
(4) 56, 32 bit
Solution
A MAC (Media Access Control) address is a 48-bit (6 bytes) unique identifier assigned to network interfaces. It's usually represented in hexadecimal format with 12 hexadecimal characters grouped in pairs, where each pair represents 1 byte (8 bits)
An IP (Internet Protocol) address is a 32-bit (4 bytes) unique identifier assigned to each device connected to a network that uses the Internet Protocol for communication. It's typically represented in dotted-decimal notation, where each decimal represents 8 bits, and there are 4 groups separated by periods
(3) 48 bits for MAC address and 32 bits for IP address is the correct option
(xxiv) MAC address is a physical or hardware address is a unique
value associated with a network adapter called NIC. MAC address is a
12-drgit hexadecimal numbers shown as below:
FC:F8 AE: CE: 78:16.
IP address is a unique address that can be used to uniquely identify
each node in network IPV4 address looks like:
192 168:0:175
Based on above paragraph answer following question.
Which of the following statement is false about IP address :
(1) It is a Internet Protocol address
(2) IP address can change if a node is removed from one network to
other
(3) IP address is not a unique address
(4) We can communicate with the computer from anywhere if we know
the IP address
Solution
(3) IP address is not a unique address.
Explanation: IP addresses are indeed unique identifiers assigned to each device on a network, ensuring proper communication.
(xxv) If on applying a hash function, every items of a list maps to
unique index in the hash table it is called.
(1) Complete hash function
(2) Total hash function
(3) Remainder hash function
(4) Perfect hash function
Solution
(4) Perfect hash function
Explanation: A perfect hash function is one where every item in a list maps to a unique index in the hash table without any collisions. In other words, each element of the set being hashed has its own unique hash value, resulting in no collisions.
(xxvi) In Binary search the key to be searched is compared with the element in the _____ of the sorted list.
(1) FRONT
(2) END
(3) TOP
(4) MIDDLE
Solution
(4) MIDDLE
(xxvii) Which of the following technique of searching compares
every element of list where the list can be in any order?
(1) Binary search
(2) Linear search
(3) Heap search
(4) Hashing search
Solution
(2) Linear search
(xxviii) Standard deviation is:
(1) the positive square of average of squared difference of each value
from the mean.
(2) the positive square root of the average of squared difference of
each value from the mean.
(3) the square root of the average of each value from the mean.
(4) the square of the average of each value from the mean.
Solution
(2) the positive square root of the average of squared difference of
each value from the mean