sample paper 2024-25, Exams of Computer science

CBSE class 12 sample paper for computer science 2024-25

Typology: Exams

2024/2025

Available from 12/11/2024

gomathivetrivel
gomathivetrivel 🇮🇳

28 documents

1 / 6

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 IV (2024-25)
COMPUTATIONAL PROGRAMMING - PYTHON
Class: XII Max. Marks: 70
Date : 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 function can be used to display the output in python
A. show() B. print() C. display() D. output()
1
2.
Tick the correct statement to print Hello World.
A. print(hello)(world) B. Print(“hello world”)
C. Print(hello world) D. print(“Hello World ”)
1
3.
Variable names can be of any length.
A. True B. False
1
4.
Which of the following is not a valid identifier name in Python?
A 5Total B) _Radius C) pie D)While
1
5.
Numbers = [ 4, 8, 9, 2.6, 5 ] is a type of which data type in python?
A. List B. Tuple C. Set D. None of these
1
6.
x=3.123, then int (x) will give?
A. 3.1 B. 0 C. 1 D. 3
1
7.
What is the output of the following code? a, b=8/4/2, 8/(4/2) print(a, b)
A. Syntax error B. 1.0,4.0 C. 4.0,4.0 D. 4,4
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 Python code?
def change(one, *two):
print(type(two))
change(1,2,3,4)
A) Integer B) Tuple C) Dictionary D) An exception is thrown
1
10.
Which of the following functions header is correct?
A) def study(a=2, b=5, c) : B) def study(a=2, b, c=5) :
C) def study(a, b=2, c=5): D) none of the above
1
11.
A function is said to be___________ if it calls itself
A. Built function B. Pre-defined function
C. recursive function D. None of the above
1
12.
The _________ of a variable is the area of a program where it may be referenced
A. External B. Global C. Scope D. Local
1
pf3
pf4
pf5

Partial preview of the text

Download sample paper 2024-25 and more Exams Computer science in PDF only on Docsity!

OXALISS INTERNATIONAL SCHOOL (CBSE), THATCHUR.

Computer Science (083)

CYCLIC TEST – IV (2024-25)

COMPUTATIONAL PROGRAMMING - PYTHON

Class: XII Max. Marks: 70

Date : 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 function can be used to display the output in python A. show() B. print() C. display() D. output()
  1. Tick the correct statement to print Hello World. A. print(hello)(world) B. Print(“hello world”) C. Print(hello world) D. print(“Hello World ”)
  1. Variable names can be of any length. A. True B. False
  1. Which of the following is not a valid identifier name in Python? A 5Total B) _Radius C) pie D)While
  1. Numbers = [ 4, 8, 9, 2.6, 5 ] is a type of which data type in python? A. List B. Tuple C. Set D. None of these
  1. x=3.123, then int (x) will give? A. 3.1 B. 0 C. 1 D. 3
  1. What is the output of the following code? a, b=8/4/2, 8/(4/2) print(a, b) A. Syntax error B. 1.0,4.0 C. 4.0,4.0 D. 4,
  1. 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. What will be the output of the following Python code? def change(one, *two): print(type(two)) change(1,2,3,4) A) Integer B) Tuple C) Dictionary D) An exception is thrown
  1. Which of the following functions header is correct? A) def study(a=2, b=5, c) : B) def study(a=2, b, c=5) : C) def study(a, b=2, c=5): D) none of the above
  1. A function is said to be___________ if it calls itself A. Built function B. Pre-defined function C. recursive function D. None of the above
  1. The _________ of a variable is the area of a program where it may be referenced A. External B. Global C. Scope D. Local
  1. To open a file c:\ test.txt for appending data, we can give the statement: (A) fobj = open(“c:\test.txt”,”a”) (B) fobj = open(“c:\test.txt”,”rw”) (C) fobj = open(file=“c:\test.txt”,”w”) (D) fobj = open(file=“c:\ test.txt”,”w”)
  1. (^) To read the entire contents of the file as a string from a file object fobj, the command

should be: (A) fobj.read(2) (B) fobj.read() (C) fobj.readline() (D) fobj.readlines()

  1. Which statement is used to change the file position to an offset value from the start? (A) fp.seek(offset,0) (B) fp.seek(offset,1) (C) fp.seek(offset,2) (D) None of these
  1. An interrupt or forced disruption that occurs when a program is run or executed is termed as ………………………………… (A) Compile time error (B) Exception (C) Runtime error (D) Logical error
  1. While accessing a dictionary, if the given key is not found, ………………. exception is raised.
  1. Which pointer is associated with a stack? A. First B. Front C. Rear D. Top
  1. Predict the output of the following code: def insert_data(stk,num): stk.append(num) stk=[2,3,4] insert_data(stk,10) print(stk) A. [2,3,4,10] B. [10,2,3,4] C. Overflow D. Underflow

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

  1. Assertion: len( ), type( ), int( ), input( ) are the functions that are always available for use. Reason: Built in functions are predefined functions that are always available for use. For using them we don’t need to import any module.
  1. Assertion: If the size of a stack is 5 and a sixth element is inserted, then Underflow happens Reason: Overflow is a condition which occurs in bounded stack

Q No. Section-B (7 x 2 = 14 Marks) Marks

  1. Rajat has written the following Python code. There are some errors in it. Rewrite the correct code and underline the corrections made. DEF execmain(): x = input("Enter a number:") if (abs(x)=x): print ("You entered a positive number") else: x=*- 1 print "Number made positive:"x execmain()
  1. a) Given a Tuple tup1=(10,20,30,40,50,60,70,80,90). What will be the output of print(tup1[3:7:2])?

b) Write the output of following code: lst1=[10,15,20,25,30] lst1.insert(3,4) lst1.insert(2,3) print(lis[-5])

  1. Differentiate between default parameter(s) and keyword parameter(s) with a suitable example for each.

OR

What is the difference between Local Variable and Global Variable? 2

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

  1. Assume that a text file named TEXT1.TXT already contains some text written into it ,write a function named COPY(),that reads the file TEXT1.TXT and create a new file named TEXT2.TXT ,which shall contain only those words from the file TEXT1.TXT which don’t start with an uppercase vowel(i.e. with ‘A’,’E’,’I’,’O’,’U’) ,for example if the file TEXT1.TXT contains He can appoint any member of the Lok Sabha then the file TEXT2.TXT shall contain He can member of the Lok Sabha
  1. Write a python Function that accepts a string and calculates the number of uppercase letters and lowercase letters. Sample String : Python ProgrammiNg Expected Output: Original String : Python ProgrammiNg No. of Upper case characters : 3 No. of Lower case characters :
  1. Write PushOn(Student) and Pop(Student) methods/functions in Python to add a new Student and delete a Student from a list of Student Name, considering them to act as push and pop operations of the Stack data structure.

Q No. SECTION D (4 X 4 = 16 Marks) Marks

  1. a) What possible outputs(s) are expected to be displayed on screen at the time of execution of the program from the following code. Select which option/s is/are correct import random print(random.randint(15,25) , end=' ') print((100) + random.randint(15,25) , end = ' ' ) print((100) - random.randint(15,25) , end = ' ' ) print((100) *random.randint(15,25) )

(i) 15 122 84 2500 (ii) 21 120 76 1500 (iii) 105 107 105 1800 (iv) 110 105 105 1900

b) Predict the output of the following code. def swap(P ,Q): P,Q=Q,P print( P,"#",Q) return (P) R= S= R=swap(R,S) print(R,"#",S)

  1. a) When Underflow and Overflow will occur in stack?

b) Write a function in Python, Push(SItem) where , SItem is a dictionary containing the details of stationary items– {Sname:price}. The function should push the names of those items in the stack who have price greater than 75. Also display the count of elements pushed into the stack. For example: If the dictionary contains the following data: Ditem={"Pen":106,"Pencil":59,"Notebook":80,"Eraser":25}

The stack should contain: Notebook Pen The output should be: The count of elements in the stack is 2

  1. (a) What is the difference between 'w' and 'a' modes?

Anshuman is a Python learner, who has assigned a task to write python Codes to perform the following operations on binary files. Help him in writing codes to perform following tasks (b) & (c): (b) Write a statement to open a binary file named SCHOOL.DAT in read mode. The file SCHOOL.DAT is placed in D: drive. (c) Consider a binary file “employee.dat” containing details such as empno:ename:salary (separator ':'). Write a python function to display details of those employees who are earning between 20000 and 30000 (both values inclusive).

35. Tarun is a student, who wants to make a python program for Sports

Department. He is using binary file operations with the help of two user

defined functions/modules.

(A) New_Entry() to create a binary file called SPORTS.DAT containing sports

related material information- item_id, item_name and item_qty.

(B) Show_Item() to display the item _name and item_qty of items which

item_qty less than 5. In case there is no item available that which quantity is

less than 5 the function displays message.

He has abled to write partial code and has missed out certain statements, so

he has left certain queries in lines. You as an expert of Python have to provide

the missing statements and other related queries based on the following code

of Tarun.

Answer any four questions (out of five) from the below mentioned questions.

import pickle

def Add_New_Product():

fopen=______________________ #1 statement to open the binary file to write

data

while True:

Prod_id = int (input (“Enter Product ID: ”) )

Prod_name = input (“Enter Product Name: ”) )

Prod_price = float (input(“Enter Product Price: ”))

record = [sid, name , age]

_________________________ #2 statement to write the list record into the

file

Choice = input(“Are hou wants to Enter more Records(y/n): ” )

if (Choice.upper() =='N'):

break

fopen.close( )

def Show_Product():

Total = 0

Count_rec = 0

Count_price = 0

with open(“ PRODUCTS.DAT”, “ rb”) as F:

while True:

try:

Rec=____________________ #3 statement to read from the file

Count_rec = Count_rec+

Total = Total+Rec[2]