0% found this document useful (0 votes)
13 views6 pages

12-CS-Halfyearly-EM-2024-Answer Key

This document is the answer key for the Higher Secondary Computer Science Half-Yearly Examination conducted in Chennai District in December 2024. It includes multiple-choice questions, short answer questions, and detailed explanations for various programming and database concepts. The document is structured into four parts, covering topics such as algorithms, data types, SQL operations, and programming constructs.

Uploaded by

nagarjunarahul40
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)
13 views6 pages

12-CS-Halfyearly-EM-2024-Answer Key

This document is the answer key for the Higher Secondary Computer Science Half-Yearly Examination conducted in Chennai District in December 2024. It includes multiple-choice questions, short answer questions, and detailed explanations for various programming and database concepts. The document is structured into four parts, covering topics such as algorithms, data types, SQL operations, and programming constructs.

Uploaded by

nagarjunarahul40
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/ 6

CHENNAI DISTRICT

Higher Secondary – Second year (+2)


Half-Yearly Examination - Dec 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

QN Answer Mark
1 (D) Parameters 1

2 (A) Pair 1
3 (C) = 1

4 (A) Algorithmic strategy 1


5 (A) Ternary 1
6 (C) for 1
7 (C) -4 1
8 (A) + 1

9 (D) [0, 1, 8] 1
10 (C) class class_name: 1
11 (C) Hierarchical 1

12 (A) DROP 1
13 (D) Carriage Return and Line Feed 1
14 (A) OS module 1

15 (A) Distinct 1

PART – II
Answer any SIX of the following: 6 × 2 = 12
Question number 24 is compulsory.
QN Answer Mark

Constructor Selectors
Constructors are functions that Selectors are functions that
16 2
build the abstract data type. retrieve information from the
data type.

An algorithm is a finite set of instructions to accomplish a particular task.


17 (OR) 2
It is a step-by-step procedure for solving a given problem.

1
QN Answer Mark
if <condition>:
statements-block 1
18 2
else:
statements-block 2
19 ComputerComputerComputer 2

20 11 2

21 SELECT * FROM student WHERE age < 18; 2

(i) SWIG - Simplified Wrapper Interface Generator.


22 1+1
(ii) MinGW - Minimalist GNU for Windows.

23 Data Visualization is the graphical representation of information and data. 2

24 {'A', 'D'} 2

PART – III
Answer any SIX of the following: 6 × 3 = 18
Question number 33 is compulsory.
QN Answer Mark
The strlen is a pure function because the function takes one variable as a 1½
parameter, and accesses it to find its length.

This function reads external memory but does not change it, and the value 1½
25
returned derives from the external memory accessed.
(OR)
strlen is a pure function because it does not modify the input string, has no side 3
effects, and returns the same result for the same input

Local scope refers to variables defined in current function. 2


Always, a function will first look up for a variable name in its local scope.
26
Suitable Example 1

min = a if a < b else b


3
print ("The Minimum of A and B is ", min)
27
(OR)
Any suitable Python code using ternary operator.

1. When we define a variable outside a function, it’s global by default.


1 Each
You don’t have to use global keyword.
(3)
28 2. We use global keyword to read and write a global variable inside a
function.
3. Use of global keyword outside a function has no effect

29 Aate Bate Cate Date Eate Fate 3


σCourse = “Big Data” (STUDENT) 1½
30
Regno, Course (STUDENT) 1½

2
QN Answer Mark

reader( ) DictReader( )
Reads CSV files into a list. Reads CSV files into a dictionary.
csv.reader works with list/tuple. csv.DictReader works with 3
31 dictionary.
Takes each line of the file and Takes additional argument
make a list of all columns. fieldnames that are used as
dictionary keys.

SQLite is a simple relational database system, which saves its data in regular
data files or even in the internal memory of the computer. 1

Advantages:
32
1. It is designed to be embedded in applications, instead of using a
separate database server program such as MySQLor Oracle. 2
2. SQLite is fast, rigorously tested, and flexible, making it easier to work.
Python has a native library for SQLite.
33 {0: 0, 1: 1, 2: 4, 3: 9, 4: 16} 3

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

(i) Parameter without Type: 2


• Types are not specified; inferred dynamically.

Example:
let rec pow a b:=
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 algorithm with explanation)

(ii) Parameter with Type:


• Explicitly declared data types.
Example: 2
let rec pow (a: int) (b: int) : int :=
if b=0 then 1
else a * pow b (a-1)

When we write the type annotations for ‘a’ and ‘b’ the parentheses are
mandatory.

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 algorithm with explanation)

3
(i) Local Scope:
34 (b) A variable declared inside the function's body or in the local scope is known as 1
local variable.

Rules of local variable:


• A variable with local scope can be accessed only within the
function/block that it is created in. 1
• When a variable is created inside the function/block, the variable
becomes local to it.
• A local variable only exists while the function is executing.
• The format arguments are also local to function.

Suitable Example:
½
(ii) Global Scope:
Defining a variable outside the scope of any function/block.
Global scope can be used anywhere in the program. 1

Basic rules for global keyword in python:


• When we define a variable outside a function, it’s global by default.
You don’t have to use global keyword. 1
• We use global keyword to read and write a global variable inside a
function.
• Use of global keyword outside a function has no effect

Suitable Example ½
(1) Less code to be written.
35 (a) (2) A single procedure can be developed for reuse, eliminating the
need to retype the code many times. 1 Each
(3) Programs can be designed more easily because a small team (5)
deals with only a small part of the entire code.
(4) Modular programming allows many programmers to collaborate on
the same application.
(5) The code is stored across multiple files.
(6) Code is short, simple and easy to understand.
(7) Errors can easily be identified, as they are localized to a subroutine or
function.
(8) The same code can be used in many applications.
(9) The scoping of variables can easily be controlled.
(Any Five points)
(1) SELECT (Symbol: σ)
35 (b) • General form σc ( R ) with a relation R and a condition C on the 1 Each
attributes of R. (5)
• The SELECT operation is used for selecting a subset with tuples
according to a given condition.
• Select filters out all tuples that do not satisfy C.

(2) PROJECT (Symbol: Π)


• The projection eliminates all attributes of the input relation but those
mentioned in the projection list.
• The projection method defines a relation that contains a vertical
subset of Relation.
(3) UNION (Symbol: ∪)
• It includes all tuples that are in tables A or in B. It also eliminates
duplicates.

4
• Set A Union Set B would be expressed as A ∪ B
(4) SET DIFFERENCE (Symbol: - )
• The result of A – B, is a relation which includes all tuples that are in A
but not in B.
• The attribute name of A has to match with the attribute name in B.
(5) INTERSECTION (Symbol: ∩) A ∩ B
• Defines a relation consisting of a set of all tuple that are in both in A
and B.
• However, A and B must be union-compatible.
(6) PRODUCT OR CARTESIAN PRODUCT (Symbol: X )
• Cross product is a way of combining two relations.
• The resulting relation contains, both relations being combined.
• A x B means A times B, where the relation A and B have different
attributes.
• This type of operation is helpful to merge columns from two relations.

(Explanation about any Five relational operator with Suitable Example)


(1) Arithmetic operators
36 (a) • An arithmetic operator is a mathematical operator that takes two
operands and performs a calculation on them. 1 Each
• Operators: +, -, *, /, %, **, // (5)

(2) Relational or Comparative operators


• A Relational operator is also called as Comparative operator which
checks the relationship between two operands.
• If the relation is true, it returns True; otherwise it returns False.
• Operators: ==, >, >=, <, <=, !=
(3) Logical operators
• Logical operators are used to perform logical operations on the given
relational expressions.
• Operators: and, or, not.
(4) Assignment operators
• Assignment operator to assign values to variable.
• Operators: +=, -=, *=, /=, %=, **=, //=
(5) Conditional operator
• Ternary operator is also known as conditional operator that evaluate
based on a condition being true or false.
• The Syntax: Variable Name = [on_true] if [Test expression] else
[on_false]
(Explanation about any Five operators)
(1) UPDATE student SET age = 18, place = 'Chennai' WHERE admno = 102;
36 (b) (2) ALTER TABLE student ADD COLUMN Address VARCHAR(50); 1 Each
(3) ALTER TABLE student RENAME COLUMN Address TO City; (5)
(4) ALTER TABLE student DROP COLUMN City;
(5) DROP TABLE student;

37 (a) The for loop is usually known as a definite loop, because the programmer 1
knows exactly how many times the loop will be executed.

5
Syntax:
for counter_variable in sequence: 1
statements-block 1
[else:
statements-block 2]

The for .... in statement is a looping statement used in Python to iterate over a 1
sequence of objects, i.e., it goes through each item in a sequence.

The control variable accesses each item of the sequence on each iteration until 1
it reaches the last item in the sequence.

Suitable Example 1
(i) COUNT()
37 (b) The SQL COUNT() function returns the number of rows in a table satisfying 1 Each
the criteria (5)
specified in the WHERE clause.
Example:
cursor.execute("SELECT COUNT(*) FROM student ")
(OR - Any suitable example)
(ii) AVG()
The SQL AVG() function returns the average of row / column data in a table.
Example:
cursor.execute("SELECT AVG(AVERAGE) FROM student ")
(OR - Any suitable example)
(iii) SUM()
The SQL SUM() function returns the sum of row / column data in a table.
Example:
cursor.execute("SELECT SUM(AVERAGE) FROM student ")
(OR - Any suitable example)

(iv) MAX()
The MAX() function returns the largest value of the selected column.
Example:
cursor.execute("SELECT sname,max(AVERAGE) FROM student ")
(OR - Any suitable example)
(v) MIN()
The MIN() function returns the smallest value of the selected column.
Example:
cursor.execute("SELECT sname,min(AVERAGE) FROM student ")
(OR - Any suitable example)
1. Computer Science
38 (a) 2. Computer 1 Each
3. Science (5)
4. Cmue cec
5. eniSrtpo
1. {1, 2, 3, 4, 5, 6}
38 (b) 2. {2, 3, 4, 5}
1 Each
3. {1}
(5)
4. {6}
5. {1, 6}

You might also like