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

CS Question Bank 2

This document is a sample question paper for Computer Science for the academic year 2024-25 at Durgapur Public School. It includes various types of questions covering Python programming, functions, file handling, and data structures, with a mix of theoretical questions and practical coding tasks. The paper assesses knowledge on topics such as data types, memory management, function parameters, file operations, and stack implementation.

Uploaded by

maheshdalle59
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)
19 views4 pages

CS Question Bank 2

This document is a sample question paper for Computer Science for the academic year 2024-25 at Durgapur Public School. It includes various types of questions covering Python programming, functions, file handling, and data structures, with a mix of theoretical questions and practical coding tasks. The paper assesses knowledge on topics such as data types, memory management, function parameters, file operations, and stack implementation.

Uploaded by

maheshdalle59
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

DURGAPUR PUBLIC SCHOOL

SAMPLE QUESTION PAPER- 2024-25


SUBJECT: COMPUTER SCIENCE(083)
REVISION TOUR
1. $ symbol can be used in naming an identifier (True/False). (1)
2. Write any 2 data types available in Python. (1)
3. range(1,10) will return values in the range of to . (1)
4. Write 2 advantages and disadvantages of Python programming language. (2)

5. What is the size of each string? (2)


(i) „Python‟
(ii) „Learning@\nCS‟
„\table‟
6. Write a program to enter 2 number and find sum and product. (3)
7. Write a program to enter temperature in Fahrenheit and convert it in Celsius. (3)
8. What is the difference between List and Tuple? (2)
9. What is the difference between List and String? (2)
10. Rewrite the following code in python after removing all syntax error(s). Underline each correction done
in the code. (3)

30=To
for K in range(0,To):
if k%4==0:
print (K*4)
else:
print (K+3)

11. Write a program to enter any number and check it is divisible by 7 or not. (3)
12. How many times loop will execute:
P=5
Q=35
while P<=Q:
P+=6
13. Find and write the output of the following python code: (3)
Msg="CompuTer" Msg1=''
for i in range(0, len(Msg)):
if Msg[i].isupper():
Msg1=Msg1+Msg[i].lower()
elif i%2==0:
Msg1=Msg1+'*'
else:
Msg1=Msg1+Msg[i].upper()
print(Msg1)

FUNCTIONS
1. What is the area of memory called, which stores the parameters and local variables of a function call?
(1)
2. What is the default return value for a function that does not return any value explicitly? (1)
3. Pick the following statements to correctly complete the function body in the given code snippet. (1)

def f(number):
#Missing function body
print(f(5))
4. What is the result of this code? (2)

def print_double(x):
print(2 ** x)
print_double(3)
5. A parameter having default value in the function header is known as a default parameter. (True/False)
6. Variables that are listed within the parentheses of a function header are called function variables.
(True/Flase)
7. Default parameters cannot be skipped in function call. (True/False)
8. A program having multiple functions is considered better designed than a program without any
functions. Why? (2)
9. What all information does a function header give you about the function? (2)
10. What are arguments? What are parameters? How are these two terms different yet related? Give
example. (4)
11. What is the utility of : (i) default arguments, (ii) keyword arguments? (4)
12. What is scope? What is the scope resolving rule of Python? (4)
13. What is the difference between local and global variable? (3)

14. What are the errors in following codes? Correct the code and predict output:

def Tot(Number) #Method to find Total


Sum = 0
for C in Range (1, Number + 1):
Sum += C
RETURN Sum
print (Tot[3]) #Function Calls
print (Tot[6])

15. Find the errors in code given below :

def minus(total, decrement)


output = total - decrement
print(output)
return (output)

PYTHON FILE HANDLING:


1. Give one difference between Text file and Binary File. (1)
2. Write a Python statement to open a text file “DATA.TXT” so that new contents can be written on it. (1)
3. What is the different in file opening mode “a” and “w”? (2)
4. What is the difference between readline() and readlines()? (2)
5. What is the purpose of using flush() in file handling operations? (2)
6. What is the difference in write() and writelines()? (2)
7. Considering the content stored in file “CORONA.TXT” (2)
O Corona O Corona Jaldi
se tum Go na
Social Distancing ka palan karona sabse
1 meter ki duri rakhona Lockdown me
ghar me ho to Online padhai karona
Complete the missing statement using „for‟ loop to print all the lines of file
f = open(“CORONA.TXT”)
for________________:
print(_____)
8. Letter is prefixed to store string in binary form. (1)
9. Write a Python statement to open a text file “DATA.TXT” in binary mode so that new contents can be
written on it. (1)
10. ___ function is used to fetch binary data from binary file. (1)
11. Write a function RECCOUNT() to read the content of binary file „NAMES.DAT‟ and display number
of records ( each name occupies 20 bytes in file ) in it. (3)
For. e.g. if the content of file is:
SACHIN
AMIT AMAN
SUSHIL
DEEPAK
HARI SHANKER
Function should display Total Records are 6.
12. _____ is the process of converting byte stream to original structure. (1)
13. Pickling is done by the function ______. (1)
14.Unpickling is done by the function _____ . (1)
15. Consider the following Binary file „Emp.txt‟, Write a function RECSHOW() to display only those
records who are earning more than 7000. (4)

16. __________ function of writer object is used to send data to csv file to store. (1)
17. Write a python function CSVCOPY() to take sourcefile, targetfile as parameter and create a
targetfile and copy the contents of sourcefile to targetfile. (4)

DATA STRUCTURE
1. What is Data Structure? (1)
2. Stack data structure is following ____________ principle. (1)
3. In stack data can be inserted or deleted from ____________ only. (1)
4. The insert operation in the stack is known as pop. (True/False) (1)
5. A condition raise due to the stack is full is known as ___________. (1)
6. What are the basic operations that can be performed on the stack? (2)
7. Write steps on how you implement stack? (2)
8. Write a python function to delete an element from the stack. (4)
9. Write functions AddPlayer(player) and DeletePlayer(player) in python to add and remove a player by
considering them as push and pop operations in a stack. (4)
10. Vedika has created a dictionary containing names and marks as key-value pairs of 5 students. Write
a program, with separate user-defined functions to perform the following operations: (5)

1. Push the keys (name of the student) of the dictionary into a stack, where the corresponding value
(marks) is greater than 70.
2. Pop and display the content of the stack.

You might also like