0% found this document useful (0 votes)
17 views4 pages

Worksheet 2 Class 12th

Uploaded by

pandtx04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views4 pages

Worksheet 2 Class 12th

Uploaded by

pandtx04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Date:21-11-24

Worksheet-2
Subject- Computer Science(083)
1. State True or False: The Python interpreter handles logical errors during code execution.

2. Identify the output of the following code snippet:

text = "PYTHONPROGRAM"

text=text.replace('PY','#') print(text)

(A) #THONPROGRAM (B) ##THON#ROGRAM (C) #THON#ROGRAM (D) #YTHON#ROGRAM

3. Which of the following expressions evaluates to False?

(A) not(True) and False (B) True or False (C) not(False and True) (D) True and not(False)

4. What is the output of the expression?

str='International'

print(str.split("n"))

(A) ('I', 'ter', 'atio', 'al') (B) ['I', 'ter', 'atio', 'al'] (C) ['I', 'n', 'ter', 'n', 'atio', 'n', 'al'] (D) Error

5. What will be the output of the following code snippet? str= "World Peace" print(str[-2::-2])

6. What will be the output of the following code?

tuple1 = (1, 2, 3)

tuple2 = tuple1

tuple1 += (4,)

print(tuple1 == tuple2)

(A) True (B) False (C) tuple1 (D) Error

7. If my_dict is a dictionary as defined below, then which of the following statements will raise an
exception?

my_dict = {'apple': 10, 'banana': 20, 'orange': 30}

(A) my_dict.get('orange')

(B) print(my_dict['apple', 'banana'])

(C) my_dict['apple']=20

(D) print(str(my_dict))

8. What does the list.remove(x) method do in Python?

(A) Removes the element at index x from the list

(B) Removes the first occurrence of value x from the list


(C) Removes all occurrences of value x from the list

(D) Removes the last occurrence of value x from the list.

9. Which of the following statements will cause an error?

(A) t=1, (B) t=(1,) (C) t=(1) (D) t=tuple(1) (1)

10. Write the missing statement to complete the following code:

file = open("example.txt", "r")


data = file.read(100)
____________________ #Move the file pointer to the beginning of the file
next_data = file.read(50)
file.close()

11. State whether the following statement is True or False:

The finally block in Python is executed only if no exception occurs in the try block.

12. What will be the output of the following code?

c = 10
def add():
global c c = c + 2 print(c,end='#') add() c=15
print(c,end='%')
(A) 12%15# (B) 15#12% (C) 12#15% (D) 12%15#

13. Which SQL command can change the degree of an existing relation?

14. What will be the output of the query?

SELECT * FROM products WHERE product_name LIKE 'App%';

(A) Details of all products whose names start with 'App'

(B) Details of all products whose names end with 'App'

(C) Names of all products whose names start with 'App'

(D) Names of all products whose names end with 'App'

15. In which datatype the value stored is padded with spaces to fit the specified length.

(A) DATE (B) VARCHAR (C) FLOAT (D) CHAR

16. Which aggregate function can be used to find the cardinality of a table?

(A) sum() (B) count() (C) avg() (D) max()

17. Which protocol is used to transfer files over the Internet?

(A) HTTP (B) FTP (C) PPP (D) HTTPS

18. Which network device is used to connect two networks that use different protocols?

(A) Modem (B) Gateway (C) Switch (D) Repeater


19. Which switching technique breaks data into smaller packets for transmission, allowing multiple
packets to share the same network resources.

Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct choice as:

(A) Both A and R are true and R is the correct explanation for A

(B) Both A and R are true and R is not the correct explanation for A

(C) A is True but R is False

(D) A is False but R is True

20. Assertion (A): In the case of positional arguments, the function call and function definition
statements match in terms of the number and order of arguments.

Reasoning (R): During a function call, positional arguments should precede keyword arguments in
the argument list. (1)

21. Assertion (A): A SELECT command in SQL can have both WHERE and HAVING clauses.

Reasoning (R): WHERE and HAVING clauses are used to check conditions, therefore, these can be
used interchangeably.

22. How is a mutable object different from an immutable object in Python? Identify one mutable
object and one immutable object from the following: (1,2), [1,2], {1:1,2:2}, ‘123’

23. Give two examples of each of the following:

(I) Arithmetic operators

(II) Relational operators .

24. If L1=[1,2,3,2,1,2,4,2, . . . ], and L2=[10,20,30, . . .], then

(I) A) Write a statement to count the occurrences of 4 in L1.

OR

B) Write a statement to sort the elements of list L1 in ascending order.

(II) A) Write a statement to insert all the elements of L2 at the end of L1.

OR

B) Write a statement to reverse the elements of list L2.

25. Identify the correct output(s) of the following code. Also write the minimum and the maximum
possible values of the variable b.

import random a="Wisdom"

b=random.randint(1,6)

for i in range(0,b,2):

print(a[i],end='#')

(A) W# (B) W#i# (C) W#s# (D) W#i#s#


26. Give an example of a table which has one Primary key and two alternate keys. How many
Candidate keys will this table have?

27. A) List one advantage and one disadvantage of star topology.

OR

B) Expand the term SMTP. What is the use of SMTP?

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy