CS12
CS12
SCHOOL
PRE-TERM QUARTERLY EXAMINATION
Time : 3:00 Hrs STD XII Marks: 70
COMPUTER SCIENCE
PART - I
Answer all the questions: 1X15=15
1. __________ is a distinct syntactic block
a. Definition b. subroutines c. modules d. function
2. A sequence of immutable objects is called __________.
a. Built in b. list c. tuple d. Derived data type
3. Namespaces are containers for mapping __________ to__________.
a. Names of variables, objects b. names of variables, address
c. address, objects d. algorithms, programs
4. Find the odd one
a. Bubble sort b. binary sort c. selection sort d. insertion sort
5. Which operator is also called as comparative operator?
a. Arithmetic b. Relational c. Logical d. Assignment
6. Which statement is generally used as a placeholder?
a. Break b. continue c. pass d. goto
7. Break, continue, pass act as a ____________ statements in python.
a. Branching b. looping c. jump d. sequential
8. Which of the following keyword is used to exit a function block?
a. Define b. return c. finally d. def
9. A variable with __________ scope can be used anywhere in the program.
a. Local b. global c. functional d. class
10. The subscript of a string may be
a. Positive b. negative c. either (a)or(b) d. none of the
above
11. Output of the following python code snippetis
x=[’red’,’blue’,green’]
x=append(’orange’)
print(x)
a. [’red’,’blue’,green’, ’orange’] b. [’orange’’red’,’blue’,green’]
c. [’red’,’blue’ , ’orange’] d. [’orange’]
12. The process of creating an object is called as
a. constructor b. destructor c. initialized d. instantiation
13. for i in range (1,11,1); print(I,end=,) Output of the python code is
a. 1,2,3,4,5,6,7,8,9,10,11 b. 1,2,3,4,5,6,7,8,9,10
c.12345678910 d. 1 2 3 4 5 6 7 8 9 10
14. Statement 1: set is also a sequence data type like List
Statement 2: Set operations such as Union, Intersection, Difference are applicable to
list
a. Statement 1 and Statement 2 are correct
b. Statement 1 and Statement 2 are incorrect
c. Statement 1 incorrect Statement 2 correct
d. Statement 1 correct Statement 2 incorrect
15. Output of the following python code is
d,m,y=20,8,2024
print(“{}/{}/{}”.format(m,d,y+7))
a. 8/20/2024 b. 20/8/2024 c. 8/20/2031 d. 20/8/2031
PART - II 6X2=12
Answer any 6 questions. Question number 24 is compulsory.
16. What is subroutine?
17. Differentiate constructor and selectors.
18. What is a literal? Explain the types of literals?
19. What is the syntax for for loop in python?
20. What is slicing a string in python?
21. List out the set of operations supported by python along with its operators.
22. How will you create constructor in python?
23. List out the types of function arguments in python.
24. Write the output of the following python code.
i=0
if(i<0): i=i+1
x-true if i<0 else false
print(x)
PART - III 6X3=18
Answer any 6 questions. Question number 33 is compulsory.
25. Differentiate pure and impure function.
26. Why access control is required?
27. Write a note on asymptotic notation.
28. What are class members? How do you define it?
29. Explain any 3 string functions with an example.
30. Explain variable-length- argument in python
31. Write a python program using while loop to demonstrate Infinite loop
32. What is the output of the following python program
str1=’welcome’
str2=’to school’
str3-str[:2]+str2[len(str2)-2:]
print(str3)
33. Differentiate ceil() and floor() function.
PART - IV 5X5=25
Answer all the questions:
34. How will you facilitate data abstraction. Explain with suitable example.
(OR)
What is binary search? Discuss with example.
35. Discuss in detail about Tokens in python.
(OR)
Write a detail note on if..elif…else statement with suitable example.
36. Explain the different types of function in python with an example.
(OR)
Explain recursive function with an example.
37. Explain with an example del, remove(),pop(),clear() functions oflist in python.
(OR)
What are the different ways to insert an element in a list. Explain with suitable
example.
38. How to construct constructor and destructor in python.
(OR)
Write a python program to generate a set of prime numbers.