Class 12 CBSE Final Term Question Bank – Computer Science
Section A
-
Question: Which of the following is not a valid variable name in Python? Justify the reason for it not being a valid name.
- (i) 5Radius
- (ii) Radius_
- (iii) _Radius
- (iv) Radius
Answer: (i) 5Radius
Reason: Variable names cannot start with a digit in Python, which is why 5Radius is invalid.
-
Question: Which of the following are keywords in Python?
- (i) break
- (ii) check
- (iii) range
- (iv) while
Answer: (i) break, (iv) while
Reason: These are reserved keywords in Python.
-
Question: Name the Python Library modules which need to be imported to invoke the following functions:
- (i) cos()
- (ii) randint()
Answer:
- (i) cos() →
math - (ii) randint() →
random
-
Question: Rewrite the following code in Python after removing all syntax errors. Underline each correction done in the code.
input('Enter a word', W) if W = 'Hello' print('Ok') else: print('Not Ok')W = input('Enter a word') # Correct input syntax if W == 'Hello': # Use '==' for comparison print('Ok') else: print('Not Ok') -
Question: Find and write the output of the following Python code:
def ChangeVal(M, N): for i in range(N): if M[i] % 5 == 0: M[i] //= 5 if M[i] % 3 == 0: M[i] //= 3 L = [25, 8, 75, 12] ChangeVal(L, 4) for i in L: print(i, end='#')1#8#5#4#
-
Question: Which protocol out of the following is used to send and receive emails over a computer network?
- (a) PPP
- (b) HTTP
- (c) FTP
- (d) SMTP
Answer: (d) SMTP
Explanation: SMTP (Simple Mail Transfer Protocol) is the standard protocol for sending emails.
-
Question: Find and write the output of the following Python code:
def Call(P=40, Q=20): P = P + Q Q = P - Q print(P, '@', Q) return P R = 200 S = 100 R = Call(R, S) print(R, '@', S) S = Call(S) print(R, '@', S)300 @ 200 300 @ 100 140 @ 20 300 @ 140
-
Question: What possible output(s) are expected to be displayed on the screen at the time of execution of the program from the following code? Also specify the minimum and maximum values that can be assigned to the variable End.
import random Colours = ["VIOLET", "INDIGO", "BLUE", "GREEN", "YELLOW", "ORANGE", "RED"] End = randrange(2) + 3 Begin = randrange(End) + 1 for i in range(Begin, End): print(Colours[i], end="&")Possible outputs:
- INDIGO&BLUE&GREEN&
- VIOLET&INDIGO&BLUE&
- BLUE&GREEN&YELLOW&
- GREEN&YELLOW&ORANGE&
Minimum value of End: 3
Maximum value of End: 4
Section B
-
Question: Write the names of the immutable data objects from the following:
- (i) List
- (ii) Tuple
- (iii) String
- (iv) Dictionary
Answer: (ii) Tuple, (iii) String
Reason: Tuples and strings are immutable in Python.
-
Question: Write a Python statement to declare a Dictionary named ClassRoll with Keys as 1, 2, 3 and corresponding values as ‘Reena’, ‘Rakesh’, ‘Zareen’ respectively.
ClassRoll = {1: 'Reena', 2: 'Rakesh', 3: 'Zareen'} -
Question: Which of the options out of (i) to (iv) is the correct data type for the variable Vowels as defined in the following Python statement?
Vowels = ('A', 'E', 'I', 'O', 'U')- (i) List
- (ii) Dictionary
- (iii) Tuple
- (iv) Array
Answer: (iii) Tuple
Reason: The variable Vowels is defined as a tuple because it is enclosed in parentheses.
-
Question: Write the output of the following Python code:
for i in range(2, 7, 2): print(i * '$')$$ $$$$ $$$$$$
-
Question: Write the output of the following Python code:
def Update(X=10): X += 15 print('X = ', X) X = 20 Update() print('X = ', X)X = 25 X = 20
-
Question: Differentiate between w and r file modes used in Python. Illustrate the difference using suitable examples.
Answer:
w mode: Opens the file for writing. If the file does not exist, it creates a new file. If it exists, it overwrites the existing content.
r mode: Opens the file for reading. If the file does not exist, it raises an error.
Example:
# 'w' mode with open('sample.txt', 'w') as f: f.write('Hello, World!') # 'r' mode with open('sample.txt', 'r') as f: print(f.read())
Section C
-
Question: Which SQL command is used to add a new attribute in a table?
Answer: ALTER TABLE table_name ADD column_name datatype;
-
Question: Which SQL aggregate function is used to count all records of a table?
Answer: COUNT()
-
Question: Which clause is used with a SELECT command in SQL to display the records in ascending order of an attribute?
Answer: ORDER BY
-
Question: Write the full form of the following abbreviations:
- (i) DDL
- (ii) DML
Answer:
- (i) DDL: Data Definition Language
- (ii) DML: Data Manipulation Language
-
Question: Observe the following tables, EMPLOYEES and DEPARTMENT, carefully and answer the questions that follow:
ENO ENAME DOJ DNO E1 NUSRAT 2001-11-21 D3 E2 KABIR 2005-10-25 D1 DNO DNAME D1 ACCOUNTS D2 HR D3 ADMIN (i) What is the Degree of the table EMPLOYEES? What is the cardinality of the table DEPARTMENT?
Answer:
- Degree of EMPLOYEES: 4 (Number of columns)
- Cardinality of DEPARTMENT: 3 (Number of rows)
(ii) What is a Primary Key? Explain.
Answer: A Primary Key is a unique identifier for a record in a table. It ensures that no two records can have the same value in the primary key column. In the EMPLOYEES table, ENO could be the primary key as it uniquely identifies each employee.
Section D
-
Question: An organization purchases new computers every year and dumps the old ones into the local dumping yard. Write the name of the most appropriate category of waste that the organization is creating every year.
Answer: (iii) E-Waste (Electronic Waste)
-
Question: Data which has no restriction of usage and is freely available to everyone under Intellectual Property Rights is categorized as:
Answer: (ii) Open Data
-
Question: What is a Unique ID? Write the name of the Unique Identification provided by the Government of India for Indian Citizens.
Answer: A Unique ID is a unique identifier assigned to individuals for identity verification. The Unique Identification provided by the Government of India is Aadhaar.
-
Question: Consider the following scenario and answer the questions that follow:
“A student is expected to write a research paper on a topic. The student had a friend who took a similar class five years ago. The student asks his older friend for a copy of his paper and then submits the entire paper as his own research work.”
(i) Which of the following activities appropriately categorizes the act of the writer?
- (A) Plagiarism
- (B) Spamming
- (C) Virus
- (D) Phishing
Answer: (A) Plagiarism
(ii) Which kind of offense is made by the student?
- (A) Cyber Crime
- (B) Civil Crime
- (C) Violation of Intellectual Property Rights
Answer: (C) Violation of Intellectual Property Rights
Section E
-
Question: Computers connected by a network across different cities is an example of _________.
Answer: (A) WAN (Wide Area Network)
-
Question: _________ is a network tool used to test the download and upload broadband speed.
Answer: Speed Test
-
Question: A ________ is a networking device that connects computers in a network by using packet switching to receive, and forward data to the destination.
Answer: Router
-
Question: _________ is a network tool used to determine the path packets taken from one IP address to another.
Answer: Traceroute
-
Question: Write the full form of the following abbreviations:
- POP
- VoIP
- NFC
- FTP
- POP: Post Office Protocol
- VoIP: Voice over Internet Protocol
- NFC: Near Field Communication
- FTP: File Transfer Protocol