computer science sample paper, Exams of Computer science

for CBSE board class 12 computer science subject 2024-25 sample paper python important questions

Typology: Exams

2023/2024

Available from 12/11/2024

gomathivetrivel
gomathivetrivel 🇮🇳

28 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
OXALISS INTERNATIONAL SCHOOL (CBSE), THATCHUR.
Computer Science (083)
CYCLIC TEST – I (2024-25)
Class: XII Max. Marks: 70
Date : 10.10.2024 Time : 3 Hrs.
General Instructions:
This question paper contains 37 questions.
All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions
The paper is divided into 5 Sections- A, B, C, D and E.
Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
All programming questions are to be answered using Python Language only.
In case of MCQ, text of the correct answer should also be written.
SECTION – A
Q No. Section-A (21 x 1 = 21 Marks) Marks
1. Which is valid keyword?
a. Int b. WHILE c.While d.if
1
2. Which of the following statement(s) would give an error after executing the
following code?
print(9/2) # Statement-1
print(9//2) # Statement-2
print(9%%2) # Statement-3
print(9%2) # Statement-4
(a) Statement-1 (b) Statement-2 (c) Statement-3 (d) Statement-4
1
3. State True or False
“The characters of string will have two-way indexing.” False(Strings in Python
have one-wayindexing (both forward and backward), not two-way)
1
4. What will be the output after the following statements?
x = 27
y = 9
while x < 30 and y < 15:
x = x + 1
y = y + 1
print(x,y)
a) 26 11 b) 25 11 c) 30 12 d) 26 10
1
5. State True or False
“variable declaration is implicit in Python” False
1
6. Which of the following is an invalid datatypes in Python?
(a) Set (b) None (c) Integer (d) Real
1
7. Which of the following is a mutable datatype in Python?
(a) String (b) List (c)Integer (d) Tuple
1
8. Select the correct output of the code: Str=“Computer” Str=Str[-4:] print(Str*2)
a. uter b. uterretu c. uteruter d. None of these
1
9. What will be the output of the following code?
D1={1: “One”,2: “Two”, 3: “C”}
1
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download computer science sample paper and more Exams Computer science in PDF only on Docsity!

OXALISS INTERNATIONAL SCHOOL (CBSE), THATCHUR.

Computer Science (083)

CYCLIC TEST – I (2024-25)

Class: XII Max. Marks: 70

Date : 10.10.2024 Time : 3 Hrs.

General Instructions:  This question paper contains 37 questions.  All questions are compulsory. However, internal choices have been provided in some questions. Attempt only one of the choices in such questions  The paper is divided into 5 Sections- A, B, C, D and E.  Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.  Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.  Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.  Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.  Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.  All programming questions are to be answered using Python Language only.  In case of MCQ, text of the correct answer should also be written. SECTION – A

Q No. Section-A (21 x 1 = 21 Marks) Marks

1. Which is valid keyword?

a. Int b. WHILE c.While d.if

2. Which of the following statement(s) would give an error after executing the

following code?

print(9/2) # Statement-

print(9//2) # Statement-

print(9%%2) # Statement-

print(9%2) # Statement-

(a) Statement-1 (b) Statement-2 (c) Statement-3 (d) Statement-

3. State True or False

“The characters of string will have two-way indexing.” False(Strings in Python

have one-wayindexing (both forward and backward), not two-way)

4. What will be the output after the following statements?

x = 27

y = 9

while x < 30 and y < 15:

x = x + 1

y = y + 1

print(x,y)

a) 26 11 b) 25 11 c) 30 12 d) 26 10

5. State True or False

“variable declaration is implicit in Python” False

6. Which of the following is an invalid datatypes in Python?

(a) Set (b) None (c) Integer (d) Real

7. Which of the following is a mutable datatype in Python?

(a) String (b) List (c)Integer (d) Tuple

8. Select the correct output of the code: Str=“Computer” Str=Str[-4:] print(Str*2)

a. uter b. uterretu c. uteruter d. None of these

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

D1={1: “One”,2: “Two”, 3: “C”}

D2={4: “Four”,5: “Five”}

D1.update(D2)

print (D1)

a) {4:’Four’,5: ‘Five’} b) Method update() doesn’t exist for dictionary

c) {1: “One”,2: “Two”, 3: “C”} d) {1: “One”,2: “Two”, 3: “C”,4: ‘Four’,5: ‘Five’}

10. Select the correct output of the following code :

s=“I#N#F#O#R#M#A#T#I#C#S”

L=list(s.split(‘#’))

print(L)

a) [I#N#F#O#R#M#A#T#I#C#S] b) [‘I’, ‘N’, ‘F’, ‘O’, ‘R’, ‘M’, ‘A’, ‘T’, ‘I’, ‘C’, ‘S’]

c) [‘I N F O R M A T I C S’] d) [‘INFORMATICS’]

11. Which of the following statement(s) would give an error after executing the

following code?

str= “Python Programming” #statement 1

x= ‘2’ #statement 2

print(str*2) #statement 3

print(str*x) #statement 4

a) statement 1 b) statement 2 c) statement 3 d) statement 4

12. Find the operator which cannot be used with a string in Python from the

following:-

a) // b) * c) + d) in

13. Select the correct output of the code:

Str = "OXALISS INTERNATIONAL CBSE SCHOOL THATCHUR "

Str = Str.split()

NewStr = Str[0] + "#" + Str[1] + "#" + Str[4]

print (NewStr)

a) OXALISS#INTERNATIONAL#CBSE# SCHOOL

b) OXALISS#INTERNATIONAL#CBSE

c) OXALISS#INTERNATIONAL#THATCHUR

d) None of these

14. What is the purpose of the try block in Python error handling?

a) To define the block of code where an exception may occur

b) To catch and handle exceptions that occur within the block

c) To ensure that the code executes without any errors

d) To terminate the program if an exception occurs

15. Which keyword is used to catch exceptions in Python?

a) try b) catch c) except d) handle

16. What is raised when a Python program encounters an error during

execution?

a) Error b) Exception c) Fault d) Bug

17. Which of the following is NOT a standard Python exception?

a) KeyError b) ValueException c) IndexError d) TypeError

18. Which Python keyword is used to raise an exception manually?

a) throw b) raise c) exception d) trigger

19. What is the purpose of the assert statement in Python?

a) To handle exceptions b) To terminate the program

c) To check if a condition is true d) To raise an exception

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

else:

Msg3=Msg3+"*"

print(Msg3)

OUTPUT

GLTME

25. a. Find output generated by the following code:

mystr = “Hello I am a Human.”

print(mystr[::-3])

Ans: .m mIlH

b. Select the correct output of the following String operations.

str1 = 'Waha'

print(str1[:3] + 'Bhyi' + str1[-3:])

1) Wah Bhyi Wah 2) WahBhyiaha 3) WahBhyiWah 4) WahBhyiWaha

26. Predict the output of the following code:

mylist = [2,14,54,22,17]

tup = tuple(mylist)

for i in tup:

print(i%3, end=",")

OUTPUT:

27. Write a Python program to reverse a string. 2

OR

( a) Given is a Python List declaration :

list= [10, 20, 30, 40, 50, 60, 70, 80]

print(list[ : : 2])

OUTPUT:

[10, 30, 50, 70]

(b) Given a list L= [10, 20, 30, 40, 50, 60, 70], what would L[-3 : 99] return?

Output:

[50, 60, 70]

28. Predict the output of following code:

test_list = [5, 6, 7]

test_tup = (9, 10)

res = tuple(list(test_tup) + test_list)

print(str(res))

output:

OR

(a) Given is a Python string declaration:

Word = "Connect Python”

Write the output of: print(Word[: : 3])

output:

Cntyo

(b) Write the output of the code given below:

dict = {"Item": "Laptop", "Make": "LG" }

dict["Price"] = 57000

dict["Make"] = "DELL"

for k in dict:

print(k, ‘@’, dict[k])

output:

Item @ Laptop

Make @ DELL

Price @ 57000

Q No. Section-C ( 3 x 3 = 9 Marks) Marks

  1. Predict the output of the following code: d = {"apple": 15, "banana": 7, "cherry": 9} str1 = "" for key in d: str1 = str1 + str(d[key]) + "@" + “\n” str2 = str1[:-1] print(str2)

output:

OR

Predict the output of the following code: line=[4,9,12,6,20] for I in line: for j in range(1,I%5): print(j,’#’,end=””) print()

output:

  1. Start with the list [11, 12, 13]. Do the following using list functions:
    1. Set the second entry (index 1) to 17
    2. Add 4, 5 and 6 to the end of the list
    3. Remove the first entry from the list
    4. Sort the list
    5. Double the list
    6. Insert 25 at index 3 Answer: listA = [11,12,13]
  2. listA[1] = 17
  3. listA.extend([4, 5, 6])
  4. listA.pop(0)
  5. listA.sort()
  6. listA = listA * 2
  7. listA.insert(3, 25)

OR

print (sum/float(count)) break OR a) Find the output of the following: def main ( ) : Moves=[11, 22, 33, 44] Queen=Moves Moves[2]+= L=len(Moves) For i in range (L): print (“Now@”, Queen[L-i-1], “#”, Moves [i]) main()

output:

Now@ 44 # 11 Now@ 55 # 22 Now@ 22 # 55 Now@ 11 # 44 b) What will the result given by the following? (a) type (6 + 3) <class 'int'> (b) print (6 / 3) 2. (c) print (6 // 3) 2 (d) print (6 % 3) 0

  1. a) FIND THE OUTPUT FOR THE FOLLOWING CODE: T1 = (12, 22, 33, 55 ,66) list1 =list(T1) new_list = [] for i in list1: if i%3==0: new_list.append(i) new_T = tuple(new_list) print(new_T)

output:

B) FIND THE OUTPUT :

def callon(b=20, a=10): b = b + a a = b - a print(b, "#", a) return b x = 100 y = 200 x = callon(x, y) print(x, "@", y) y = callon(y) print(x, "@", y)

output:

  1. A) Predict the output of the Python Code given below: d={"Rohan":67,"Ahasham":78,"naman":89,"pranav":79}

print(d) sum= for i in d: sum+=d[i] print(sum) print("sum of values of dictionaries",sum)

output:

{'Rohan': 67, 'Ahasham': 78, 'naman': 89, 'pranav': 79} 67 145 234 313 sum of values of dictionaries 313 B) Write the output displayed on execution of the following python code: LS=["HIMALAYA", "NILGIRI", "ALASKA", "ALPS"] D={} for S in LS : if len(S) %4 == 0: D[S] = len(S) for K in D: print (K,D[K], (sep = "#")

output:

HIMALAYA#

ALPS#

  1. I. When is ZeroDivisionError exception raised in Python? II. Give an example code to handle ZeroDivisionError? The code should display the message "Division by Zero is not allowed" in case of ZeroDivisionError exception, and the message "Some error occurred" in case of any other exception.

OR

A) What is the output of the following code? try: x = 10 / 0 except ZeroDivisionError: print("Division by zero") finally: print("Finally block")

output:

Division by zero Finally block B) What is the output of the following code? try: raise Exception("An error occurred") except Exception as e: print(e) finally: print("Finally block")

output:

An error occurred Finally block

Q No. SECTION E (2 X 5 = 10 Marks) Marks

  1. (a) Predict the output of the code given below: 2+