← All previous-year papers

CUET 2022 Computer Science Question Paper with Answers & Solutions

85 questions with answer key & explanations

Q1.
Considering the given statement in Python Print("Hello world") What type of error will be generated?
A. Value Error
B. Logical Error
C. Name Error
D. Syntax Error
Show answer & explanation

Correct answer: C

Python is case-sensitive; the built-in function is print (lowercase), not Print. Using Print is treated as an undefined name, which raises a NameError.

Q2.
The British scientist who invented world wide web in 1990 is ______
A. Allen Turing
B. Claude Shanon
C. Tim Berners Lee
D. Herman Hollerith
Show answer & explanation

Correct answer: C

Tim Berners-Lee, a British scientist, invented the World Wide Web in 1989-1990 while at CERN.

Q3.
Read the following statements and arrange in correct order. A. Exception is raised B. Executes exception C. Program searches for exception handler D. Create exception object E. An error encountered Choose the correct answer from the options given below:
A. A→B→C→D→E
B. E→D→C→A→B
C. E→D→B→C→A
D. E→D→A→C→B
Show answer & explanation

Correct answer: D

Exception handling flow: an error is encountered (E), an exception object is created (D), the exception is raised (A), the program searches for an exception handler (C), and the handler executes the exception block (B). Order: E→D→A→C→B.

Q4.
In SQL, like condition allows you to use wild card characters to perform matching. Which of the following is a valid wild card character?
A. #
B. $
C. *
D. %
Show answer & explanation

Correct answer: D

In SQL LIKE, the valid wildcard characters are % (any number of characters) and _ (a single character). % is the valid choice here.

Q5.
Match List I with List II. List I: A. Data redundancy B. Data inconsistency C. Data Isolation D. Data dependency List II: I. Updating the structure of a data file requires modification in all the application programs accessing the file. II. Duplication of data at different places(files). III. Separation of resource or data modification made by different transactions. IV. Mismatch of data, maintained at different places. Choose the correct answer from the options given below:
A. A-IV, B-II, C-I, D-III
B. A-II, B-IV, C-III, D-I
C. A-II, B-IV, C-I, D-III
D. A-III, B-I, C-II, D-IV
Show answer & explanation

Correct answer: B

Data redundancy = duplication of data (II); Data inconsistency = mismatch of data at different places (IV); Data isolation = separation of resource/data (III); Data dependency = updating structure requires modifying all programs (I). So A-II, B-IV, C-III, D-I.

Q6.
Rohan starting working on MYSQL server. Kindly arrange the the following commands in a sequence so that he can create a table, then insert a record into it and display all the records. A. Insert into command B. Create database <databasename>; C. Create table command D. Use <databasename>; E. Select * from < tablename>; Choose the correct answer from the options given below:
A. B D C A E
B. B A E D C
C. A B E D C
D. A C D B E
Show answer & explanation

Correct answer: A

Correct sequence: create the database (B), use it (D), create the table (C), insert a record (A), then display records (E). So B D C A E.

Q7.
______ is not a DDL command.
A. Drop
B. Alter
C. Update
D. Create
Show answer & explanation

Correct answer: C

DDL commands include CREATE, ALTER, DROP, TRUNCATE. UPDATE is a DML command, not DDL.

Q8.
______ is known as design of a database.
A. Constraints
B. Keys
C. Schema
D. Query
Show answer & explanation

Correct answer: C

The schema is the overall design/structure of a database.

Q9.
Mr. Sameer wants to connect 20 systems, which are present within a single hall. Help him choose the best device out of the following to achieve his purpose. [Note that the data arriving on any of the lines should be sent to the intended node/receiver only]
A. Repeater
B. Hub
C. Switch
D. Gateway
Show answer & explanation

Correct answer: C

A switch forwards data only to the intended recipient (using MAC addresses), unlike a hub which broadcasts to all nodes. So a switch is the best device.

Q10.
In file mode ___, the file offset position is end of the file.
A. r
B. w
C. w+
D. a
Show answer & explanation

Correct answer: D

Append mode 'a' opens the file with the offset positioned at the end of the file. Modes r, w, w+ position the offset at the beginning.

Q11.
Choose the correct output of the following SQL query: Select MID("SAVE ENVIRONMENT",6,7);
A. E ENVIR
B. ENVIRO
C. ENVIRON
D. ENVIRONMENT
Show answer & explanation

Correct answer: C

MID(str,6,7) extracts 7 characters starting at position 6. "SAVE ENVIRONMENT": position 6 is 'E' (S=1,A=2,V=3,E=4,space=5,E=6). 7 characters from position 6 = 'ENVIRON'.

Q12.
A mobile connected to a laptop through USB is an example of ______.
A. LAN
B. WAN
C. MAN
D. PAN
Show answer & explanation

Correct answer: D

A Personal Area Network (PAN) connects devices within the personal range of a single user, such as a mobile connected to a laptop via USB.

Q13.
Which command is used to delete table from a database?
A. Delete Table <tableName>;
B. Drop Table <tableName>;
C. Delete <tableName>;
D. Drop Table <tableName> from <tableName>;
Show answer & explanation

Correct answer: B

DROP TABLE <tableName>; removes the entire table structure and data from the database.

Q14.
Match List I with List II List I: A. Browser B. Multiport modem C. Protocol D. BCC List II: I. SMTP II. Google Chrome III. Blind carbon copy IV. Hub Choose the correct answer from the options given below:
A. A-II, B-I, C-IV, D-III
B. A-I, B-IV, C-II, D-III
C. A-II, B-IV, C-I, D-III
D. A-III, B-I, C-II, D-IV
Show answer & explanation

Correct answer: C

Browser = Google Chrome (II); Multiport modem = Hub (IV); Protocol = SMTP (I); BCC = Blind carbon copy (III). So A-II, B-IV, C-I, D-III.

Q15.
Given the following SQL string functions: middle( ), mid( ), substr( ), substring( ) Find the odd-one out.
A. mid( )
B. substr( )
C. middle( )
D. substring( )
Show answer & explanation

Correct answer: C

mid(), substr() and substring() are valid SQL string functions used to extract substrings. middle() is not a valid SQL function, so it is the odd one out.

Q16.
Given below are two statements: Statement I. When all the value are sorted in ascending or descending order, the middle value is called mode. Statement II. Value that appears most number of times in the given data of an attribute/variable is called mode. In the light of the above statements, choose the correct answer from the options given below:
A. Both statement I and Statement II are true
B. Both statement I and Statement II are false
C. Statement I is correct but statement II is false
D. Statement I is incorrect but statement II is true
Show answer & explanation

Correct answer: D

Statement I describes the median (middle value when sorted), not the mode, so it is incorrect. Statement II correctly defines mode as the most frequently occurring value. So Statement I incorrect, Statement II true.

Q17.
Adjacent elements are compared and swapped in ______ sorting technique.
A. Bubble sort
B. Insertion sort
C. Selection sort
D. Adjacent sort
Show answer & explanation

Correct answer: A

In bubble sort, adjacent elements are repeatedly compared and swapped if out of order.

Q18.
Which of the following statements are correct for Queue? A. Queue is an ordered linear data structure B. Deque can support both stack and queue operations C. Queue is a non-linear data structure D. Queue works on FILO principle E. Deque is a version of Queue which does not allow insertion and deletion at both ends Choose the correct answer from the options given below:
A. A and C only
B. A and B only
C. B and C only
D. A, B and E only
Show answer & explanation

Correct answer: B

A is correct (queue is an ordered linear structure). B is correct (a deque supports both stack and queue operations). C is wrong (queue is linear). D is wrong (queue is FIFO). E is wrong (a deque allows insertion/deletion at both ends). So A and B only.

Q19.
The default reference point for file-object.seek(offset,[reference point]) is:
A. 0
B. -1
C. 1
D. 2
Show answer & explanation

Correct answer: A

The default whence value for seek() is 0, which means the beginning of the file.

Q20.
From a text file “myfile.txt”, Kriti will read next line through file object Fl using
A. Fl.readlines( )
B. Fl.readline( )
C. Fl.readnext( )
D. Fl.read( )
Show answer & explanation

Correct answer: B

readline() reads a single (next) line from the file. readlines() reads all lines into a list; read() reads the whole file; readnext() is not valid.

Q21.
The postfix form of A * B + C/D is
A. *AB/CD +
B. A*BC+/D
C. AB*CD/+
D. ABCD+/*
Show answer & explanation

Correct answer: C

A*B+C/D: A*B → AB*, C/D → CD/, then add the two → AB*CD/+.

Q22.
The file offset position of a file opened in <r> mode is ______.
A. End of the file
B. Begining of the file
C. Any where in the file
D. One byte before the end of the file
Show answer & explanation

Correct answer: B

In read mode 'r', the file pointer is positioned at the beginning of the file.

Q23.
Consider the following python code: def myDiv(x, y): if y == 0: raise ZeroDivisionError return x/y What is the output of the following? n=myDiv(4,0) print(n)
A. 0.0
B. No output
C. ZeroDivisionError
D. ValueError
Show answer & explanation

Correct answer: C

Since y=0, the function executes 'raise ZeroDivisionError', which raises that exception (and since it is uncaught, it is reported). The output/error is ZeroDivisionError.

Q24.
______ Communication mode allows communication in both directions simultaneously.
A. Simplex
B. Half duplex
C. Full duplex
D. Half simplex
Show answer & explanation

Correct answer: C

Full duplex allows simultaneous two-way communication. Half duplex allows both directions but not at the same time; simplex is one-way only.

Q25.
Choose the advantages of a database over file system from the following statements. A. Reduces data redundancy and saves storage. B. Sharing of data is possible. C. Difficult to access the data in formatted way. D. Data inconsistency is reduced to larger extent E. Databases are not portable. Choose the correct answer from the options given below:
A. B, C, and D only
B. A, B and D only
C. A, B and E only
D. A, C and D only
Show answer & explanation

Correct answer: B

Advantages of DBMS: reduces redundancy (A), enables data sharing (B), and reduces inconsistency (D). C and E are disadvantages/incorrect. So A, B and D only.

Q26.
The like operator makes use of two wild card characters underscore (_) and %. Which of the following statement(s) is/are correct w.r.t these operators? A. % represents zero, one or multiple characters B. Underscore represents zero, one or multiple characters C. Underscore represents only multiple characters D. Underscore represents exactly a single character E. % represents zero character Choose the most appropriate answer from the options given below:
A. A and D only
B. A and C only
C. A only
D. B and E only
Show answer & explanation

Correct answer: A

% matches zero, one or many characters (A correct). _ (underscore) matches exactly one single character (D correct). B, C, E are wrong. So A and D only.

ABC fitness centre has computerized their Gym by keeping details of their Trainees in Trainer table and clients in Customer table. Table: Trainer (TId, TName, Activity, Salary, Dt_Appoint): G101 Manish Kick Boxing 18000 2020-10-12; G102 Sachin Core 22000 2021-06-09; G103 Aahan Core 25000 2020-05-30; G104 Aparna Zumba 15000 2021-11-12; G105 Nitin Yoga 20000 2022-02-15. Table: Customer (CId, Cust_Name, Gender, TId, Fee, Membership): C1 Sabina F G101 10000 12; C2 Rohit M G101 9000 10; C3 Asad M G102 12000 15; C4 John M G103 6000 6; C5 Aastha F G104 8000 8; C6 Neha F G102 9000 10; C7 Zubain M G102 10000 12; C8 Deljeet F G104 6000 6.
Q27.
Choose correct SQL query to Display the details of all male customers having membership more than 10 months.
A. Select * from Customer Where Gender= “M” and Membership >10;
B. Select CId, CName, Fee from Customer Where Gender=“M” and Membership>“10”;
C. Select * from Customer Where Gender=“Male” and Membership<10;
D. Select * from Customer Where Gender=“M” or Membership>10;
Show answer & explanation

Correct answer: A

Need all details (*) where Gender is 'M' AND Membership > 10. Option A is correct. B selects only some columns and quotes the number; C uses 'Male' and <10; D uses OR.

Q28.
Choose correct SQL query to display total customers under each trainer in the Gym.
A. Select TId,TName, Count(*) from Customer Where Trainer.TId= Customer.TId;
B. Select TName,count(*) from Customer group by TId;
C. Select TId , count(*) from Customer group by TId;
D. Select TId, count(CId) from Customer Where Trainer.TId= Customer.TId;
Show answer & explanation

Correct answer: C

To get total customers per trainer, group the Customer table by TId and count. 'Select TId, count(*) from Customer group by TId;' is correct. B selects TName which is not in Customer and not in GROUP BY; A and D lack GROUP BY.

Q29.
Choose correct SQL query to display the names of all trainees with their date of appointment in descending order, who are taking core activity.
A. Select TName, Dt_Appoint from Trainer Order by Dt_Appoint desc Where Activity=“Core”;
B. Select TName, Dt_Appoint from Trainer Where Activity=“Core” Order by Dt_Appoint desc;
C. Select TName, Dt_Appoint from Trainer Order by Dt_Appoint desc Having Activity=“Core”;
D. Select TName, Dt_Appoint from Trainer Where Activity=“Core” Order by desc Dt_Appoint;
Show answer & explanation

Correct answer: B

Correct SQL clause order: SELECT ... FROM ... WHERE ... ORDER BY ... DESC. Option B is syntactically correct. A and C place ORDER BY before WHERE/HAVING; D has wrong ORDER BY syntax.

Q30.
Choose correct SQL query to update the membership of all the customers, under Trainer with code G101 and G102, to 12 months.
A. Update Customer Set Membership=12 Where TId=“G101” or TId=“G102”;
B. Alter table Customer Add Membership=12 Where TId=“G101” or TId=“G102”;
C. Update Customer Set Membership=12 Where TId=“G101” and TId=“G102”;
D. Update Customer Add Membership= 12 Where TId=“G101” or TId=“G102”;
Show answer & explanation

Correct answer: A

Use UPDATE ... SET Membership=12 with WHERE matching either G101 OR G102 (a row's TId cannot equal both, so OR is required). Option A is correct. C uses AND (returns nothing); B/D use wrong syntax.

Q31.
Choose the correct SQL query to display a report showing Trainer name, Salary, Customer name and Fee for all Trainers having salary between 20000 to 25000. A. Select TName, Salary, Cust_Name, Fee From Customer C, Trainer T Where T.TId=C.TId and Salary >=20000 and Salary<=25000; B. Select TName, Salary, Cust_Name, Fee From Customer, Trainer Where Customer.TId=Trainer.TId and Salary between 20000 and 25000; C. Select TName, Salary, C_Name, Fee From Customer C, Trainer T Where C.TId= T.TId and Salary between 20000 and 25000; D. Select TName, Salary, C_Name, Fee From Customer, Trainer Where C.TId= T.TId and 20000<=Salary<=25000; E. Select TName, Salary, Cust_Name, Fee From Customer C, Trainer T Where T.TId= C.TId and Salary between 20000 and 25000; Choose the most appropriate answer from the options given below :
A. A, B and C only
B. A, D and E only
C. B, C and E only
D. A, B and E only
Show answer & explanation

Correct answer: D

Correct queries must join Customer and Trainer on TId and use the proper column name Cust_Name with a valid salary range. A (>=20000 and <=25000), B (between, no alias), and E (between with aliases) all use Cust_Name and a valid join/condition. C and D use the invalid column 'C_Name'. So A, B and E only.

Q32.
______ type is returned by the readlines( ) method of the file object.
A. String
B. Tuple
C. List of strings
D. Dictionary
Show answer & explanation

Correct answer: C

readlines() returns a list of strings, where each element is one line of the file.

Q33.
What is the length of MAC Address in bits?
A. 48 bits
B. 64 bits
C. 24 bits
D. 72 bits
Show answer & explanation

Correct answer: A

A MAC address is 48 bits (6 bytes) long.

Q34.
Given below are two statements: one is labelled as Assertion A and other is labelled as Reason R. Assertion A: Wi-Fi gives its users the flexibility to move around within the network area while being connected to the network. Reason R: Wireless network connects communicating devices to each other without any wire. In the light of the above statements, choose the most appropriate answer from the options given below:
A. Both A and R are correct and R is the correct explanation of A
B. Both A and R are correct and R is not the correct explanation of A
C. A is correct but R is not correct
D. A is not correct but R is correct
Show answer & explanation

Correct answer: A

Both statements are true, and the reason (wireless networks connect without wires) correctly explains why Wi-Fi allows mobility. So A is the answer.

Q35.
Choose the Network Topology that requires a central controller.
A. Bus
B. Star
C. Mesh
D. Tree
Show answer & explanation

Correct answer: B

In star topology, all nodes connect to a central controller/hub.

Q36.
______ is world wide interoperability for microwave access, uses a larger spectrum to deliver connections to various devices.
A. Wi-Fi
B. Wireless MAN
C. WiMax
D. Microwave
Show answer & explanation

Correct answer: C

WiMax stands for Worldwide Interoperability for Microwave Access.

Q37.
Examples of Guided media are ______. A. Radio Waves B. Optical-fiber C. Micro waves D. Twisted pair E. Coaxial cable Choose the correct answer from the options given below:
A. A, B, and D only
B. B, C and D only
C. B, D and E only
D. B, C and E only
Show answer & explanation

Correct answer: C

Guided (wired) media include optical fiber (B), twisted pair (D) and coaxial cable (E). Radio waves and microwaves are unguided. So B, D and E only.

Q38.
The mid point of the sorted list is important in ______.
A. Binary search
B. Linear search
C. Insertion sort
D. Sequential search
Show answer & explanation

Correct answer: A

Binary search repeatedly examines the midpoint of a sorted list to halve the search space.

Q39.
Consider the following function for insertion_sort def insertion_sort(list3): n=len(list3) for i in ______: # [statement-1] temp= ______ #[ statement-2] j=i-1 while j >= 0 and ______: #[statement-3] list3[j+1]=list3[j] j =______ # [statement-4] ______ = temp #[statement-5] Given the following options for the statements. A. temp <list3[j] B. list3[i] C. list3[j+1] D. range(n) E. j-1 Choose the correct sequence of statement.
A. D→B→E→A→C
B. D→B→A→E→C
C. B→D→A→E→C
D. B→A→D→E→C
Show answer & explanation

Correct answer: B

statement-1: for i in range(n) (D); statement-2: temp=list3[i] (B); statement-3: while ... and temp<list3[j] (A); statement-4: j=j-1 (E); statement-5: list3[j+1]=temp (C). Sequence D→B→A→E→C.

Q40.
Which of the following is (are) attribute(s) of file object? A. closed B. mode C. next D. name E. tell Choose the correct answer from the options given below:
A. B and D only
B. D only
C. B, D and E only
D. A, B and D only
Show answer & explanation

Correct answer: D

File object attributes include closed, mode and name. 'next' and 'tell' are methods, not attributes. So A, B and D only.

Case study based question: An Educational Institute in Delhi make use of DBMS to store details of students. The database 'school-record' has two tables. 1. Student table; 2. Stulibrary Table. BookID is the unique identification number of each book. Minimum issue duration of a book is one day. Student table: StuID Numeric, StuName Varchar(20), StuAddress Varchar(50), StuFatherName Varchar(20), StuContact Numeric, StuAadhar Numeric, StuClass Varchar(5), StuSection Varchar(1). Stulibrary table: BookID Numeric, StuID Numeric, Issued_date Date, Return_date Date.
Q41.
Identify the SQL query which displays the data of table Stulibrary in ascending order of student ID.
A. Select * from Stulibrary order by BookID;
B. Select * from Stulibrary order by StuID ascending;
C. Select * from Stulibrary order by StuID Asc;
D. Select * from Stulibrary order by StuID DESC;
Show answer & explanation

Correct answer: C

Ascending order by StuID uses 'ORDER BY StuID ASC'. Option C is correct; the keyword is ASC, not 'ascending' (B is wrong), A orders by BookID, D is descending.

Q42.
The primary key of Stulibrary table is/are:
A. BookID
B. BookID, StuID
C. BookID, Issued_date
D. Issued_date
Show answer & explanation

Correct answer: C

A student may borrow the same BookID on different dates, and a book may be issued to different students; so BookID alone is not unique. The combination BookID + Issued_date uniquely identifies each issue record. So BookID, Issued_date.

Q43.
Which of the following SQL query will fetch ID of those issued books which have not been returned?
A. Select BookID from Stulibrary where BookID is NULL;
B. Select BookID from Stulibrary where StuID is NULL;
C. Select BookID from Stulibrary where Issued_date is NULL;
D. Select BookID from Stulibrary where Return_date is NULL;
Show answer & explanation

Correct answer: D

Books not returned have a NULL Return_date. So 'WHERE Return_date IS NULL' fetches those BookIDs.

Q44.
The alternate key for Student table will be ______
A. StuName
B. StuContact
C. StuAadhar
D. StuClass
Show answer & explanation

Correct answer: C

An alternate key is a candidate key not chosen as the primary key. StuAadhar is unique to each student (Aadhaar number), making it the alternate key. StuName, StuContact and StuClass can repeat.

Q45.
Which of the following SQL queries will display dates on which number of issued books is greater than 5?
A. Select Issued_date from Stulibrary group by Issued_date where count(*) > 5;
B. Select Issued_date from Stulibrary group by Return_date having count(*) > 5;
C. Select Issued_date from Stulibrary group by Issued_date having count(*) > 5;
D. Select Issued_date from Stulibrary group by Return_date where count(*) > 5;
Show answer & explanation

Correct answer: C

Group by Issued_date and filter aggregated counts using HAVING count(*) > 5. Option C is correct. A/D use WHERE with an aggregate (invalid), and B/D group by the wrong column.

Q46.
Identify primary key in the given table student: Name AdmNo Class Section: Ankit 101 X A; Anuj 102 XII B; Bhanu 103 XII A; Babita 104 XI B; (blank name) 105 XII C.
A. Name
B. AdmNo
C. Section
D. Class
Show answer & explanation

Correct answer: B

AdmNo (Admission Number) is unique for each student and has no missing value, so it is the primary key. Name can repeat or be blank; Class and Section repeat.

Q47.
If a table has 5 tuples and 7 attributes, then what will be the degree and cardinality of the table?
A. Degree= 7, Cardinality=5
B. Degree= 7, Cardinality=7
C. Degree= 5, Cardinality=5
D. Degree= 5, Cardinality=7
Show answer & explanation

Correct answer: A

Degree = number of attributes (columns) = 7; Cardinality = number of tuples (rows) = 5.

Q48.
Find the output: s = “CuEt#2022” f = open(“new.Txt”,”w+”) f.write(s) f.seek(0) c = f.read(9) for i in c: if i.isupper( ) : print(i.lower( ) , end=“#”) elif i.islower( ) : print(i.upper( ) , end=“#”) elif int(i).isdigit( ) : print(int(i) + 1, end=“#”) else: print(“$” , end =“#”) f.close( )
A. c#U#c#T#2#0#2#2#
B. C#u#E#t##3#1#3#3#
C. c#U#c#T#$#3#1#3#3#
D. C#u#c#t###2#0#2#2#
Show answer & explanation

Correct answer: C

Reading 9 chars: 'C','u','E','t','#','2','0','2','2'. C(upper)→c#; u(lower)→U#; E(upper)→e#; t(lower)→T#; '#' is neither upper/lower and int('#') errors—but per intended logic it falls to else → $#; '2'→int+1=3#; '0'→1#; '2'→3#; '2'→3#. Result: c#U#e#T#$#3#1#3#3#, matching option C (transcribed 'c' for e).

Q49.
Consider the table given below. TableA (SNo, Name, Class): 1 Mehek 8A; 2 Mahira 6A; 3 Lavanya 7A; 4 Sanjay 7A; 5 Abhay 8A. TableB (SNo, Name, Class): 1 Aastha 7A; 2 Mahira 6A; 3 Mohit 7B; 4 Sanjay 7A. Output (SNo, Name, Class): 1 Mehek 8A; 3 Lavanya 7A; 5 Abhay 8. Identify the operation applied to the given tables to get the given output
[Figure in original paper — see source PDF]
A. TableA X TableB
B. TableA U TableB
C. TableA - TableB
D. TableA ∩ TableB
Show answer & explanation

Correct answer: C

The output contains rows present in TableA but not in TableB (Mehek, Lavanya, Abhay), which is the set difference TableA - TableB.

Q50.
Consider the given text file 'pledge.txt': India is my country. All Indian are my brothers and sisters f=open('pledge.txt', 'r') #Statement 1 line = f.readlines( ) #Statement 2 print(len(line)) #Statement 3 f.close( ) #Statement 4 Identify the correct output, will be given by statement 3.
A. 62
B. 60
C. 1
D. 2
Show answer & explanation

Correct answer: D

readlines() returns a list of lines. The file has 2 lines, so len(line) = 2.

Q51.
Write the output of the given statement on the basis of given Pandas series; 's'. a 2 b 4 c 6 d 8 e 10 f 12 print(s[:3])
A. a 2 b 4
B. a 2 b 4 c 6 d 8
C. a 2 b 4 c 6
D. d 8 e 10 f 12
Show answer & explanation

Correct answer: C

s[:3] uses positional slicing returning the first 3 elements (indices 0,1,2): a 2, b 4, c 6.

Q52.
Rajesh read the given csv file in a dataframe and he is not aware of how to skip the column heading while reading. Choose the correct argument required to solve this problem: Carno Cartype Cost 0 2317 Sedan 300000 1 1543 Luxury 400000 2 2054 Hatch back 1000000 3 1669 4x4 700000
A. sep
B. end
C. header
D. head
Show answer & explanation

Correct answer: C

The 'header' parameter of read_csv controls which row is used as column headings (e.g., header=None to skip/ignore the heading row).

Q53.
Which package/software is most suitable to create the CSV file?
A. Any word processing
B. Any spreadsheet package
C. Any Presentation package
D. Any Database software
Show answer & explanation

Correct answer: B

CSV (Comma Separated Values) files store tabular data and are most suitably created/edited with a spreadsheet package (e.g., Excel, Calc).

Q54.
Consider a dataframe 'df', which statement(s) is(are) incorrect w.r.t. df operations? A. df['x']=[10,20,30], will add a new column 'x' to dataframe df. B. df.loc['x']=[30,40,70], will add a new column 'x' to dataframe df. C. df['x']=[10,20,30], will add a new row to the dataframe df. D. df.loc['x']=[30,40,70], will always add a new row to the dataframe df. E. df.drop('x', axis=0), will delete the row with label 'x' from the dataframe df. Choose the correct answer from the options given below:
A. B, C and D only
B. A and E only
C. B and E only
D. C only
Show answer & explanation

Correct answer: A

df['x']=... adds a column (A correct), so C is incorrect. df.loc['x']=... adds a row (D is correct in general), so B (says column) is incorrect. E correctly drops row 'x'. The incorrect statements are B, C and D.

Q55.
Consider the table given below: Table: STUDENT (ADM, NAME, CLASS): 1 Anshuman 12A; 2 Arun Lal 12C; 3 Sachin 12A; 4 Kapil 12B; 5 Sunil 12A; 6 Virat 12C. Based on the above table, which command will give the following result: CLASS No of students 12A 3 12C 2
A. Select CLASS, Count(*) From STUDENT Group by CLASS;
B. Select CLASS, Count(*) 'No of students' From STUDENT GROUP by CLASS;
C. SELECT CLASS,COUNT(No of students) FROM STUDENT Group By CLASS Having count(*)>1;
D. SELECT CLASS,COUNT(*) 'No of students' FROM STUDENT Group By CLASS Having count(*)>1;
Show answer & explanation

Correct answer: D

The result shows only classes with more than one student (12A=3, 12C=2; 12B with 1 is excluded) and a column alias 'No of students'. Option D groups by CLASS, aliases COUNT(*) as 'No of students', and filters HAVING count(*)>1.

Q56.
Consider the table given below: Table: STUDENT (ADMNO, NAME, CLASS, SCORE): A001 Amit 12A 90; A002 Amit 12B 91; A003 Bhavana 12A 90; A004 Yamini 12A 89; A005 Ashok 12B 95. Which of the following command will display all the records according to their names in descending order and their scores in descending order ?
A. SELECT * FROM STUDENT ORDER BY NAME , SCORE DESC;
B. SELECT * FROM STUDENT ORDER BY NAME AND SCORE DESC;
C. SELECT * FROM STUDENT ORDER BY NAME DESC, SCORE DESC;
D. SELECT * FROM STUDENT ORDER BY NAME DESC AND SCORE DESC;
Show answer & explanation

Correct answer: C

To sort by NAME descending and SCORE descending, each column needs its own DESC keyword separated by a comma: ORDER BY NAME DESC, SCORE DESC.

Q57.
Given are the two statements: one is lebelled as Assertion A and the other is labelled as Reason R. Assertion A: We need to install matplotlib for creating graphs using the command: pip install matplotlib Reason R: For plotting using matplotlib, we need to import pyplot module using: import matplotlib.pyplot as plt In the light of the above statements, choose the correct answer from the options given below.
A. Both A and R are true and R is the correct explanation of A
B. Both A and R are true but R is the NOT the correct explanation of A
C. A is true but R is false
D. A is false but R is true
Show answer & explanation

Correct answer: B

Both statements are true: matplotlib is installed via 'pip install matplotlib' and pyplot is imported via 'import matplotlib.pyplot as plt'. However, importing pyplot is not the reason for installing matplotlib, so R does not explain A.

Q58.
Match List I with List II List I: A. E-waste B. Reduce C. Reuse D. Recycle List II: I. Minimize the purchase according to need only II. Devices that are no longer in use. III. Conversion of devices into something to use again and again. IV. Process of re-using the waste after modification. Choose the correct answer from the options given below:
A. A-III, B-II, C-I, D-IV
B. A-II, B-I, C-III, D-IV
C. A-II, B-I, C-IV, D-III
D. A-I, B-III, C-II, D-IV
Show answer & explanation

Correct answer: B

E-waste = devices no longer in use (II); Reduce = minimize purchase to need (I); Reuse = use devices again and again (III); Recycle = re-using waste after modification (IV). So A-II, B-I, C-III, D-IV.

Q59.
______ was the first Web browser developed by the National Centre for Supercomputing Application (NCSA).
A. Mozilla Firefox
B. Opera
C. Mosaic
D. Google Chrome
Show answer & explanation

Correct answer: C

Mosaic was the early web browser developed at NCSA (National Center for Supercomputing Applications).

Q60.
Ms. Bhavika wants to change the index of the dataframe and the output for the same is given below: Name Stream student1 ananya humanities student2 bhavya humanities Identify the correct statement to change the index.
A. d1.index['student1', 'student2']
B. d1.index =['student1', 'student2']
C. d1.index[ ]= ['student1', 'student2']
D. d1.index( )= ['student1', 'student2']
Show answer & explanation

Correct answer: B

The index attribute is reassigned with df.index = [...]. So d1.index = ['student1', 'student2'].

Q61.
In data science for data analysis, which of the python library are more popular?
A. Swift
B. Django
C. Open office
D. Pandas
Show answer & explanation

Correct answer: D

Pandas is the popular Python library for data analysis. Swift is a language, Django a web framework, OpenOffice an office suite.

Q62.
Which malware is used to generate revenue for its developer?
A. Spyware
B. Adware
C. Trojan
D. Ransomware
Show answer & explanation

Correct answer: B

Adware displays advertisements to generate revenue for its developer.

Q63.
A ______ is a hacker with an aim to bring about political and social change.
A. White hats
B. Hacktivist
C. Black hats
D. Grey hats
Show answer & explanation

Correct answer: B

A hacktivist hacks to promote political or social change.

Q64.
Find output for the following: Select substr(“Every cloud has a silver lining”, 7,5);
A. cloud
B. cloud has a silver lining
C. Every c
D. very
Show answer & explanation

Correct answer: A

substr(str,7,5) extracts 5 characters starting at position 7. 'Every cloud...': position 7 is 'c' (E=1,v=2,e=3,r=4,y=5,space=6,c=7). 5 chars = 'cloud'.

Q65.
Find the output for following: import numpy as np pencil= np.array([10,20,30]) eraser= np.array([40,50,70]) pen= np.array([11,16,17,18]) import pandas as pd Stationary= pd.DataFrame([pencil, pen, eraser], columns=['AB', 'CD', 'EF', 'GH']) print(Stationary)
A. AB CD EF GH 0 10 20 30 NaN 1 11 16 17 18 2 40 50 70 NaN
B. AB CD EF GH 0 10 20 30 No value 1 11 16 17 18 2 40 50 70 No value
C. AB CD EF GH 0 10 20 30 0 1 11 16 17 18 2 40 50 70 0
D. AB CD EF GH 0 10 20 30 - 1 11 16 17 18 2 40 50 70 -
Show answer & explanation

Correct answer: A

pencil and eraser have 3 elements; pen has 4. The DataFrame has 4 columns, so missing values for the 3-element rows are filled with NaN. Row0=pencil(10,20,30,NaN), Row1=pen(11,16,17,18), Row2=eraser(40,50,70,NaN).

Q66.
Autopct is used in pie plot to display the ______ of that part as a label.
A. Value
B. Legend
C. Percentage
D. Data
Show answer & explanation

Correct answer: C

The autopct parameter in pie() displays the percentage value of each slice as a label.

Q67.
Consider the following code: import pandas as pd import matplotlib.pyplot as plt nutrition=['Omega3', 'Vitamin B12', 'Calcium', 'Vitamin D3'] Nvalues=[40,50,60,70] colval=['red','blue', 'green', 'yellow'] plt.pie(Nvalues, labels=nutrition, colors= colval) plt.______(“Nutritional Value”) #Statement1 plt. ______ #Statement2 Choose the appropriate option to complete Statment1 and Statement2.
[Figure in original paper — see source PDF]
A. title, show( )
B. show( ), title
C. pie, display( )
D. title, display( )
Show answer & explanation

Correct answer: A

plt.title('Nutritional Value') sets the chart title (Statement1) and plt.show() displays the chart (Statement2). So title, show().

Q68.
Consider following stock value data Stockframe (rows ITC, KPL, WPM, SAM; columns March, April, May, June, July): ITC 150 156 170 180 184; KPL 200 222 224 251 255; WPM 400 411 412 411 413; SAM 312 312 311 333 335. Find output for following: Stockframe.loc[ ['KPL', 'WPM'] ]
A. rows KPL and WPM only with all month columns (KPL 200 222 224 251 255; WPM 400 411 412 411 413)
B. rows KPL, WPM and SAM with all month columns
C. rows KPL and WPM with only March and April columns
D. boolean table for KPL and WPM across all months
Show answer & explanation

Correct answer: A

.loc[['KPL','WPM']] selects the rows labelled KPL and WPM with all columns. So output is the KPL and WPM rows with all month columns.

Q69.
Bad posture, backaches, neck and shoulder pain can be prevented by arranging the work space as recommended by ______
A. doctor
B. therapist
C. ergonomists
D. Psychologist
Show answer & explanation

Correct answer: C

Ergonomics deals with designing the workspace to suit the user and prevent posture-related problems; ergonomists recommend such arrangements.

Q70.
Which command is used for combining/merging dataframes in pandas?
A. pd.combine( )
B. pd.merge( )
C. pd.join( )
D. pd.show( )
Show answer & explanation

Correct answer: B

pd.merge() is used to combine/merge two dataframes in pandas.

Q71.
Identify the correct customisations on the bar chart. A. Line style B. Line width C. Edge color D. Color of the bar E. Marker Choose the correct answer from the options given below:
A. A, B and C only
B. D and E only
C. A, B, C and D only
D. A, B, C, D and E
Show answer & explanation

Correct answer: C

Bar charts can be customised with line style, line width, edge color and bar color. Marker is a property of line/scatter plots, not bars. So A, B, C and D only.

Q72.
Rohan wants to create the pandas series with first 5 even numbers with index as 'a', 'b', 'c', 'd', 'e'. Choose the correct statements to do the same. Assuming that Pandas library is already imported with object alias as pd and numpy as np.
A. pd.Series(np.arange(2,12,2), index=['a','b','c','d','e'])
B. pd.Series(np.range(2,12,2), index=['a','b','c','d','e'])
C. pd.Series(np.arange(2,10,2), index=['a','b','c','d','e'])
D. pd.Series(pd.arange(2,12,2), index=['a','b','c','d','e'])
Show answer & explanation

Correct answer: A

First 5 even numbers are 2,4,6,8,10 = np.arange(2,12,2). Use pd.Series with these and the given index. Option A is correct. B uses np.range (invalid); C stops at 8 (only 4 numbers); D uses pd.arange (invalid).

Q73.
Given a dataframe d1 with columns name, stream and Roll_no. Prabhat wants to print the details of 'Bhavya' along with stream. Identify the correct statement.
A. print(d1[['name'],['stream']] [d1['name']=='Bhavya'])
B. print(d1[['name','stream']] [d1['name']=='Bhavya'])
C. print(d1[['name']=='Bhavya'])
D. print(d1[['name','stream']] [d1['name']='Bhavya'])
Show answer & explanation

Correct answer: B

Select columns with a list d1[['name','stream']] and filter rows with the boolean mask [d1['name']=='Bhavya']. Option B is correct. A has wrong column-list syntax; C is incomplete; D uses '=' instead of '=='.

Q74.
Give the output for the following query: select monthname(“2003-11-10”);
A. October
B. November
C. 10
D. 11
Show answer & explanation

Correct answer: B

In the date '2003-11-10', month 11 is November. monthname() returns the month name 'November'.

Q75.
Assume the given tables Dance and Music. Dance (SNo, Name, Class): 1 Aastha 7A; 2 Mahira 6A; 3 Mohit 7B; 4 Sanjay 7A. Music (SNo, Name, Class): 1 Mehek 8A; 2 Mahira 6A; 3 Lavanya 7A; 4 Sanjay 7A; 5 Abhay 8A. Which operation should be applied to the table to get the following output? Output (SNo, Name, Class): 1 Aastha 7A; 2 Mahira 6A; 3 Mohit 7B; 4 Sanjay 7A; 1 Mehek 8A; 3 Lavanya 7A; 5 Abhay 8A.
[Figure in original paper — see source PDF]
A. U
B.
C. -
D. X
Show answer & explanation

Correct answer: A

The output combines all distinct rows from both tables, which is the Union (U) operation.

Q76.
Given below are two statements: Statement I: All switches are hubs. Statement II: All hubs are switches. In the light of the above statements, choose the most appropriate answer from the options given below
A. Both Statement I and Statement II are correct.
B. Both Statement I and Statement II are incorrect.
C. Statement I is correct but Statement II is incorrect.
D. Statement I is incorrect but Statement II is correct.
Show answer & explanation

Correct answer: B

Switches and hubs are distinct devices; a switch is not a hub and a hub is not a switch. Both statements are incorrect.

Q77.
The hacker takes advantage of congested and chaotic network environment in ______ to sneak into system undetected.
A. Asymmetric routing.
B. Buffer overflow attacks.
C. Traffic flooding.
D. Denial of service.
Show answer & explanation

Correct answer: C

In traffic flooding, the network is overwhelmed/congested, creating chaos that lets a hacker sneak in undetected.

Q78.
'sqlalchemy is a library that is used to interact with MySQL database by providing required credentials'. Which of the following statement(s) is/are correct? A. “pip install sqlalchemy” command is used to install sqlalchemy B. create_engine( ) enables the connection to be established between database and pandas. C. create_engine( ) does not return any object. D. create_engine( ) takes only database name as the parameter for connecting with pandas. E. String inside create_engine( ) is known as connection string. Choose the correct answer from the options given below:
A. A, B and C only.
B. A, B and E only
C. B, C and D only.
D. A, C and E only
Show answer & explanation

Correct answer: B

A is correct (pip install sqlalchemy). B is correct (create_engine establishes connection). E is correct (the string is a connection string). C is wrong (create_engine returns an engine object) and D is wrong (it takes a full connection string, not just a database name). So A, B and E only.

Q79.
Match List I with List II List I: A. DataFrame.shape B. DataFrame.T C. DataFrame.index D. DataFrame.columns List II: I. To display names of columns II. To display the labels III. To display dimensions of data dataframe IV. To interchange columns and rows Choose the correct answer from the options given below:
A. A-III, B-II, C-I, D-IV
B. A-IV, B-I, C-II, D-III
C. A-III, B-IV, C-II, D-I
D. A-II, B-I, C-III, D-IV
Show answer & explanation

Correct answer: C

shape = dimensions (III); T = transpose, interchange rows and columns (IV); index = labels (II); columns = names of columns (I). So A-III, B-IV, C-II, D-I.

Q80.
Consider the following series: sera (a 1, b 2) serb (x 10, y 20, a 100, b 20) Choose the correct value of sera after execution of the following statement sera.add(serb, fill_value=0)
A. a 1 b 2 x 10 y 20
B. a 101 b 22 x 10 y 20
C. 101 22 110 120
D. a 101 b 22 x NaN y NaN
Show answer & explanation

Correct answer: B

With fill_value=0, missing labels are treated as 0. a: 1+100=101; b: 2+20=22; x: 0+10=10; y: 0+20=20. So a 101, b 22, x 10, y 20.

Q81.
______ is a service that allows us to put a website or a web page onto the internet and make it a part of the World Wide Web.
A. Web server
B. Web hosting
C. Web site
D. Web upload
Show answer & explanation

Correct answer: B

Web hosting is the service that publishes a website/web page on the internet as part of the World Wide Web.

Q82.
Identify the incorrect pair related to etiquettes in digital society.
A. Net etiquettes- Be Ethical, Be Respectful, Be Responsible.
B. Communication etiquettes- Be Precise, Be polite, Be credible
C. Digital etiquettes- Be Kind, Be considerate.
D. Social media etiquettes- Be Secure, Be Reliable.
Show answer & explanation

Correct answer: C

Per NCERT, net etiquettes (be ethical/respectful/responsible), communication etiquettes (be precise/polite/credible) and social media etiquettes (be secure/reliable) are standard. 'Digital etiquettes- Be Kind, Be considerate' is not the standard listed pair, so it is the incorrect pair.

Q83.
An ______ is a person who deliberately sows discord on the internet by starting quarrels or upsetting people, by posting inflammatory or off topic messages in an online community, just for amusement.
A. Internet addict
B. Internet troll
C. Netizen
D. Digital citizen
Show answer & explanation

Correct answer: B

An internet troll deliberately posts inflammatory/off-topic messages to provoke and upset others.

Q84.
Writing emails or responses or posts we make on different websites or mobile Apps is a part of ______.
A. Digital citizen.
B. Passive Digital Footprint.
C. Active Digital Footprint.
D. Digital Social Circle.
Show answer & explanation

Correct answer: C

Active digital footprint is the data we intentionally create/leave, such as emails, posts and responses. Passive footprint is data collected without explicit action.

Q85.
Assume df is a dataframe. ______ is used to find the average of squared differences from the mean. ______ is calculated as the square root of the variance.
A. df.var( ), df.std( )
B. df.mean( ), df.mode( )
C. df.StandardDeviation( ), df.variance( )
D. df.std( ), df.var( )
Show answer & explanation

Correct answer: A

The average of squared differences from the mean is the variance, df.var(). The square root of variance is the standard deviation, df.std(). So df.var(), df.std().

Original question paper source: National Testing Agency (NTA), CUET (UG) 2022. Reproduced for educational use. Answers & explanations by UniDrill.