[go: up one dir, main page]

0% found this document useful (0 votes)
29 views7 pages

12 CS Quarterly EM 2024 Answer Key

Uploaded by

nikhilsiva33
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)
29 views7 pages

12 CS Quarterly EM 2024 Answer Key

Uploaded by

nikhilsiva33
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/ 7

CHENNAI DISTRICT

Higher Secondary – Second year (+2)


Quarterly Examination 2024
COMPUTER SCIENCE

ANSWER KEY

Time allowed: 3 Hrs] [Total Marks: 70

PART – I
Choose the most appropriate answer from the given four alternatives and write the
option code and the corresponding answer. 15 × 1 = 15
Q. No Answer Mark
1 (A) Arguments 1
2 (D) Abstract datatype 1
3 (B) Protected members 1
4 (C) = 1
5 Mere Attempt 1
6 (A) >>> 1
7 (A) # 1
8 (A) for 1
9 (C) 2 4 6 8 1
10 (A) Lambda 1
11 (D) def 1
12 (A) + 1
13 (C) Immutable 1
14 (B) 8 1
15 (D) Instantiation 1

Part – II
Answer any SIX of the following: 6 × 2 = 12
Question number 24 is compulsory.
Q. No Answer Marks
Abstract Data type (ADT) is a type (or class) for objects whose
16 2
behaviour is defined by a set of value and a set of operations.
Namespaces are containers for mapping names of variables to
17 2
objects.
Finding a particular element (value) from a set is called as 1
18 searching.
Types of searching: (1) Linear Search (2) Binary Search 1

1
Q. No Answer Marks

19 The value of m = 20 2

The range( ) generates a list of values starting from start till stop-1. 1
20 Syntax:
range (start, stop, [step]) 1

21 Mere attempt 2

22 EMISEMISEMIS 2

• The del statement is used to delete known elements whereas 1


23 • The remove( ) function is used to delete elements of a list if
its index is unknown. 1

24 4 5.6…… 1 False 2

Part - III
Answer any SIX of the following: 6 × 3 = 18
Question number 33 is compulsory.
Q. No Answer Marks
Pure Function Impure Function
25 The return value of the pure The return value of the 3
functions solely depends on its impure functions does not
arguments passed. solely depend on its
arguments passed.
if you call the pure functions with if you call the impure
the same set of arguments, you functions with the same set of
will always get the same return arguments, you might get the
values. different return values
They do not have any side They have side effects
effects.
They do not modify the They may modify the
arguments which are passed to arguments which are passed
them to them
(Any Three differences)
• Local scope refers to variables defined in current function. 1
26
• Always, a function will first look up for a variable name in its
1
local scope.

• Suitable Example 1
27 • The complexity of an algorithm f (n) gives the running time
and/or the storage space required by the algorithm in terms of 1
n as the size of input data.

• Time Complexity:
o The Time complexity of an algorithm is given by the 1
number of steps taken by the algorithm to complete the
process.

2
• Space Complexity: 1
o Space complexity of an algorithm is the amount of
memory required to run to its completion.
28 • Ternary operator is also known as conditional operator that
evaluates something based on a condition being true or false. 1

• Syntax:
Variable Name = [on_true] if [Test expression] else [on_false] 1
• Suitable Example 1
29 10 11 12 13 14 15
Value of x when the loop exit 16 3

30 ceil( ) floor( )
Returns the smallest integer Returns the largest integer less
greater than or equal to the than or equal to the given value. 1
given number

General format: General format:


math.ceil(x) math.floor(x) 1
Suitable Example Suitable Example
1

31 Suitable Python program 3

32 Suitable Python program 3


33 9 3
TAMILNADU

Part – IV
Answer all questions: 5 × 5 = 25
Q. No Answer Marks
34 (a) Parameters are the variables in a function definition and arguments are
the values which are passed to a function definition. 1

(i) Parameter without Type ½

Example:
let rec pow a b:= 1½
if b=0 then 1
else a * pow a (b-1)

• In the above function definition variable ‘a’ and ‘b’ are the
parameters, the value which is passed to the variable ‘a’ and ‘b’
are the arguments.
• We have not mentioned any data types to the parameters.
(OR) Any suitable example with proper explanation

(ii) Parameter with Type ½

3
Example:
let rec pow (a: int) (b: int) : int := 1½
if b=0 then 1
else a * pow b (a-1)
• In the above function definition variable ‘a’ and ‘b’ are having the
data type - integer. Which means, value passed to the
parameters should be integers.
(OR) Any suitable example with proper explanation
34 (b) To facilitate data abstraction, you will need to create two types of
functions: 2
(i) Constructors (ii) Selectors.

(i) Constructors:
• Constructors are functions that build the abstract data type. 1½
• Example:
city:= makecity (name, lat, lon)
Here makecity (name, lat, lon) is the constructor
which creates the object city.

(ii) Selectors:
• Selectors are functions that retrieve information from the data 1½
type.
• Example:
getname(city)
getlat(city)
getlon(city)
(OR) Any suitable example for constructor & Selector
35 (a) (1) Modules contain instructions, processing logic, and data.
(2) Modules can be separately compiled and stored in a library. 1
(3) Modules can be included in a program. Each
(4) Module segments can be used by invoking a name and some
parameters.
(5) Module segments can be used by other modules.
35 (b) • Bubble sort is a simple sorting algorithm.
• The algorithm starts at the beginning of the list of values stored 2
in an array.
• It compares each pair of adjacent elements and swaps them if
they are in the unsorted order.

• Procedure
1. Start with the first element i.e., index = 0, compare 3
the current element with the next element of the array.

2. If the current element is greater than the next


element of the array, swap them.
3. If the current element is less than the next or right
side of the element, move to the next element. Go to
Step 1 and repeat until end of the index is reached.

4
Q. No Answer Marks

36 (a) (1) The input( ) function


• The input( ) function is used to accept data as input at run time.
• The input( ) accepts all data as string or characters but not as 1
numbers.

• The syntax:
Variable = input (“prompt string”)
½
• Suitable Example

1
(2) The print() function
• In Python, the print() function is used to display result on the
screen.
1
• The syntax:
print(“string to be displayed as output ”)
print(variable) ½

• Suitable Example
1
36 (b) (a) id( ) 1
• Returns the “identity of an object” ie. the memory address of the
object.
• Suitable Example

(b) chr( ) 1
• Returns the Unicode character for the given ASCII value.
• Suitable Example

(c) round( )
• Returns the nearest integer to its input.
1
• General format:
round(number [,ndigits])
• Suitable Example

(d) type( )
• Returns the type of an object for the given single object.
• Suitable Example 1

(e) pow( )
• Returns the computation of a raised to the power of b.
• Suitable Example 1
37 (a) Suitable Python program using if…elif…else 5

37 (b) (i) Concatenation (+) 1


• Joining of two or more strings is called as Concatenation.
• The plus (+) operator is used to concatenate strings in python.
• Suitable Example

5
(ii) Append (+ =) 1
• Adding more strings at the end of an existing string is known as
append.
• The operator += is used to append a new string with an existing
string.
• Suitable Example

(iii) Repeating (*)


• The multiplication operator (*) is used to display a string in 1
multiple number of times.
• Suitable Example

(iv) String slicing


• Slice is a substring of a main string. 2
• A substring can be taken from the original string by using [ ]
operator and index or subscript values. Thus, [ ] is also known as
slicing operator.
• Using slice operator, you have to slice one or more substrings
from a main string.
• General format of slice operation:
str[start:end]
• Suitable Example
38 (a) (i) Union:
• It includes all elements from two or more sets 1
• Operator used: |
• Function used: union( )
• Suitable Example.

(ii) Intersection:
• It includes the common elements in two sets 1
• Operator used: &
• Function used: intersection( )
• Suitable Example.

(iii) Difference:
• It includes all elements that are in first set (set A) but not in the

second set (set B)
• Operator used: - (minus)
• Function used: difference( )
• Suitable Example.

(iv) Symmetric difference:



• It includes all the elements that are in two sets (sets A and B) but
not the one that are common to two sets.
• Operator used: ^ (caret)
• Function used: symmetric_difference( ).
• Suitable Example.
6
Q. No Answer Marks
38 (b) (i) (12, 78, 91, 'Tamil', 'Telugu', 3.14, 69.48) 1
(ii) (91, 'Tamil', 'Telugu') Each
(iii) (12, 78, 91, 'Tamil', 'Telugu')
(iv) ('Telugu', 3.14, 69.48)
(v) (12, 78, 91, 'Tamil', 'Telugu', 3.14, 69.48)

K. KANNAN,
Chennai Girls’ Hr. Sec. School,
Rotler Street, Chennai – 600112.

-o O o-

You might also like