Students can Download Tamil Nadu 12th Computer Science Model Question Paper 1 English Medium Pdf, Tamil Nadu 12th Computer Science Model Question Papers helps you to revise the complete Tamilnadu State Board New Syllabus and score more marks in your examinations.
TN State Board 12th Computer Science Model Question Paper 1 English Medium
- The question paper comprises of four parts.
- You are to attempt all the parts. An internal choice of questions is provided wherever applicable.
- All questions of Part I, II, III and IV are to be attempted separately.
- Question numbers 1 to 15 in Part I are Multiple Choice Questions of one mark each.
These are to be answered by choosing the most suitable answer from the given four alternatives and writing the option code and the corresponding answer
- Question numbers 16 to 24 in Part II are two-mark questions. These are to be answered in about one or two sentences.
- Question numbers 25 to 33 in Part III are three-mark questions. These are to be answered in about three to five short sentences.
- Question numbers 34 to 38 in Part IV are five-mark questions. These are to be answered in detail Draw diagrams wherever necessary.
Time: 3 Hours
Maximum Marks: 70
Part – I
Choose the correct answer. Answer all the questions: [15 × 1 = 15]
The file extension to save excel files are _______.
(a) xls or xlsx
(c) exe or XL
(d) XL or XLX
(a) xls or xlsx
Python has a collector to clean up unreferenced object.
How many types of DML are there?
To open the file updating data, click _______.
g++ is a program that calls GNU C compiler called _______.
________ are used for interfacing with C programs.
(a) C types
(c) M in GW
(d) Boost python
(a) C types
Which function is used to print the data in dictionary format without order?
________ is a list containing another list as an element.
(a) N list
(b) Nested list
(d) Add list
(b) Nested list
In python, _______ function is used to accept data as input at run time.
Which one of the following is the exponential operator?
A ______ is a part of a program.
(c) flow chart
(d) system software
The arrangement of private instance variables and public methods ensures the principle of _______.
(b) data encapsulation
(b) data encapsulation
How many operands are there in ternary operator?
Pow (2, -3) gives ________.
______ assign values to the tables specified in the bar chart.
Part – II
Answer any six questions. Question No. 21 is compulsory. [6 x 2 = 12]
Differentiate Interface and Implementation.
Interface just defines what an object can do, but won’t actually do it.
Implementation carries out the instructions defined in the interface.
Give example for valid Identifiers.
Sum, total marks, regno, num 1.
The Structured Query Language (SQL) is a standard programming language to access and manipulate databases. SQL allows the user to create, retrieve, alter, and transfer information
Give example for open function.
>>> f = open(“sample.txt”) # open file in current directory and f is file object
>>> f = open(‘c:\\pyprg\\ch 13sample5.csv’) # specifying full path
Write about ‘init’ functions.
Constructor is the special function that is automatically executed when an object of a class is created. In Python, there is a special function called “init” which act as a Constructor. It must begin and end with double underscore. This function will act as an ordinary function; but only difference is, it is executed automatically when the object is created. This constructor function f can be defined with or without arguments. This method is used to initialize the class variables.
Write a program to print the following output.
import matplotlib.pyplot as plt
This window is a matplotlib window, which allows you to see your graph. You can hover the graph and see the coordinates in the bottom right.
Which punctuation should be used in the blank?
Define Required Arguments.
“Required Arguments” are the arguments passed to a function in correct positional order. Here, the number of arguments in the function call should match exactly with the function definition. You need atleast one parameter to prevent syntax errors to get the required output.
Write note on Assignment operators.
In Python, = is a simple assignment operator to assign values to variable. Let a = 5 and b = 10 assigns the value 5 to a and 10 to b these two assignment statement can also be given as a,b=5,10 that assigns the value 5 and 10 on the right to the variables a and b respectively. There are various compound operators in Python like +=, -=, *=, /=, %=, **= and //= are also available.
Part – III
Answer any six questions. Question No. 29 is compulsory. [6 × 3 = 18]
Write note on Asymptotic Notations. Classify them.
Asymptotic Notations are languages that uses meaningful statements about time and space complexity. The following three asymptotic notations are mostly used to represent time complexity of algorithms:
(i) Big O
Big O is often used to describe the worst-case of an algorithm.
(ii) Rig Ω
Big Omega is the reverse Big O, if Bi O is used to describe the upper bound (worst – case) of a asymptotic function, Big Omega is used to describe the lower bound (best-case).
(iii) Big Θ
When an algorithm has a complexity with lower bound = upper bound, say that an algorithm has a complexity O (n log n) and Ω (n log n), it’s actually has the complexity Θ (n log n), which means the running time of that algorithm always falls in n log n in the best-case and worst-case.
Write note on CSV files.
CSV File cannot store charts or graphs. It stores data but does not contain formatting, formulas, macros, etc.
A CSV file is also known as a Flat File. Files in the CSV format can be imported to and exported from programs that store data in tables, such as Microsoft Excel or Open Office Calc.
Write note on where clause in SQL.
The WHERE clause is used to filter the records. It helps to extract only those records which satisfy a given condition. For example in the student table, to display the list of students of age 18 and above in alphabetical order of their names, the command is given as below: SELECT * FROM Student WHERE Age>=18 ORDER BY Name;
To display the list of students in the descending order of names of those students of age 18 and above the command is given as :
SELECT * FROM Student WHERE Age>= 18 ORDER BY Name DESC;
Give an example and syntax for group by clause.
The syntax for the GROUP BY clause is
SELECT <column-names> FROM <table-name> GROUP BY <column-name>HAVING condition];
To apply the above command on the student table :
SELECT Gender FROM Student GROUP BY Gender;
The following command will give the below given result:
The point to be noted is that only two results have been returned. This is because we only have two gender types ‘Male’ and ‘Female’. The GROUP BY clause grouped all the ‘M’ students together and returned only a single row for it. It did the same with the ‘F’ students. For example to count the number of male and female students in the student table, the following command is given :
SELECT Gender, count(*) FROM Student GROUP BY Gender;
Illustrate with an example program to change global variable from inside a function using global keyword.
x = 0 # global variable
x = x + 5 # increment by 2
print (“Inside add() function x value is :”,x)
print (“In main x value is :”,x)
Inside add() function x value is : 5
In main x value is : 5
Write note on Lambda functions.
- Lambda function is mostly used for creating small and one-time anonymous function.
- Lambda functions are mainly used in combination with the functions like filter(), map() and reduce().
Give any 3 applications of scripting language.
- To automate certain tasks in a program.
- Extracting information from a data set.
- Less code intensive as compared to traditional programming language.
Give program to join two tuples
# Program to join two tuples
Tup 1 =(2,4,6,8,10)
Tup2 = (1,3,5,7,9)
Tup3 = Tup1 + Tup2
(2, 4, 6, 8, 10, 1, 3, 5, 7, 9)
for x in range (2,11,2) :
2 4 6 8 10
Part – IV
Answer all the following questions. [5 × 5 = 25]
(a) Compare CSV files with XLS file.
- Excel is a binary file that holds information about all the worksheets in a file, including both content and formatting.
- XLS files can only be read by applications that have been especially written to read their format, and can only be written in the same way.
- Excel is a spreadsheet that saves files into its own proprietary format viz. xls or xlsx.
- Excel consumes more memory while importing data.
- CSV format is a plain text format with a series of values separated by commas.
- CSV can be opened with any text editor in Windows like notepad, MS Excel, OpenOffice, etc.
- CSV is a format for saving tabular information into a delimited text file with extension .csv
- Importing CSV files can be much faster, and it also consumes less memory.
(b) Explain any 5 important features of python over C++.
- Python uses Automatic Garbage Collection whereas C++ does not.
- C++ is a statically typed language, while Python is a dynamically typed language.
- Python runs through an interpreter, while C++ is pre-compiled.
- Python code tends to be 5 to 10 times shorter than that written in C++.
- In Python, there is no need to declare types explicitly where as it should be done in C++
- In Python, a function may accept an argument of any type, and return multiple values without any kind of declaration beforehand. Whereas in C++ return statement can return only one value.
(a) Write a program to update a change range of values.
MyList = [1, 3, 5, 7, 9]
print (“List Odd numbers… “)
for x in MyList:
MyList[0:5] = 2,4,6,8,10
print (“List Even numbers… “)
for y in MyList:
List Odd numbers…
List Even numbers…
(b) Explain list and range ( ) functions in python with sample program.
The range( ) is a function used to generate a series of values in Python. Using range( ) function, you can create list with series of values. The range() function has three arguments.
Syntax of range ( ) function:
range (start value, end value, step value)
- start value – beginning value of series. Zero is the default beginning value.
- end value – upper limit of series. Python takes the ending value as upper limit – 1.
- step value – It is an optional argument, which is used to generate different interval of values.
Example : Generating whole numbers up to 10
for x in range (1, 11):
(a) Find output:
T = (12, 78, 91, “Tamil”, “Telugu”, 3.14, 69.48)
1. Print (T)
2. Print ( T [2:5] )
3. Print ( T[:5] )
4. Print ( T[4:] )
5. Print ( T [:])
1. (12, 78, 91, “Tamil”, “Telugu”, 3.14, 69.48)
2. (91, “Tamil”, “Telugu”)
3. (12, 78, 91, “Tamil”, “Telugu”)
4. (“Telugu”, 3.14, 69.48)
5. (12, 78, 91, “Tamil”, “Telugu”, 3.14, 69.48)
(b) Find Output:
T = (2,4,6, 8,10)
(2, 4, 6, 8, 10)
Name Error: name “T” not defined.
(a) Differentiate Algorithm with program.
- Algorithm helps to solve a given problem logically and it can be contrasted with the program.
- Algorithm can be categorized based on their implementation methods, design techniques etc.
- There is no specific rules for algorithm writing but some guidelines should be followed.
- Algorithm resembles a pseudo code which can be implemented in any language.
- Program is an expression of algorithm in a programming language.
- Algorithm can be implemented by structured or object oriented programming approach.
- Program should be written for the selected language with specific syntax.
- Program is more specific to a programming language.
(b) Explain the various characteristics of an Algorithm.
- Input: Zero or more quantities to be supplied.
- Output: At least one quantity is produced.
- Finiteness: Algorithms must terminate after finite number of steps.
- Definiteness: All operations should be well defined. For example operations involving division by zero or taking square root for negative number are unacceptable.
- Effectiveness: Every instruction must be carried out effectively.
- Correctness: The algorithms should be error free.
- Simplicity: Easy to implement.
- Unambiguous: Algorithm should be clear and unambiguous. Each of its steps and their inputs/outputs should be clear and must lead to only one meaning.
- Feasibility: Should be feasible with the available resources.
- Portable: An algorithm should be generic, independent of any programming language or an operating system able to handle all range of inputs.
- Independent: An algorithm should have step-by-step directions, which should be independent of any programming code.
(a) Explain literals in python.
Literal is a raw data given in a variable or constant. In Python, there are various types of literals.
(i) Numeric (ii) String (iii) Boolean
(i) Numeric Literals: Numeric Literals consists of digits and are immutable (unchangeable).
Numeric literals can belong to 3 different numerical types Integer, Float and Complex.
To demonstrate Numeric literals
# Program to demonstrate Numeric Literals
a = 0b 1010 #Binary Literals
b = 100 #Decimal Literal
c = 0o310 #Octal Literal
d = Ox12c #Hexadecimal Literal
print (“Integer Literals :”,a,b,c,d)
float_1 = 10.5
float_2 = 1.5e2
print (“Float Literals :”,float_l,float_2)
x = 1 + 3.14 j
print (“Complex Literals :”, x)
Print (“x = “, x , “Imaginary part of x = “, x.imag, “Real part of x = “, x.real)
#End of the Program
Integer Literals : 10 100 200 300
Float Literals : 10.5 150.0
Complex Literals :
x = (1.3.14) Imaginary part of x = 3.14 Real part of 9 x = 1.0
(ii) String Literals: In Python a string literal is a sequence of characters surrounded by quotes. Python supports single, double and triple quotes for a string. A character literal is a single character surrounded by single or double quotes. The value with triple-quote is used to give multi line string literal.
(iii) Boolean Literals: A Boolean literal can have any of the two values: True or False.
(iv) Escape Sequences: In Python strings, the backslash “\” is a special character, also called the “escape” character. It is used in representing certain whitespace characters: “\t” is a tab, “\n” is a newline, and “\r” is a carriage return. For example to print the message “It’s raining”, the Python command is
>>> print (“It\’s rainning”)
Python supports the following escape sequence characters.
(b) Explain Recursive functions in python.
When a function calls itself is known as recursion. Recursion works like loop but sometimes it makes more sense to use recursion than loop. You can convert any loop to recursion.
A recursive function calls itself. Imagine a process would iterate indefinitely if not stopped by some condition! Such a process is known as infinite iteration. The condition that is applied in any recursive function is known as base condition. A base condition is must in every recursive function otherwise it will continue to execute like an infinite loop.
Overview of how recursive function works
(i) Recursive function is called by some external code.
(ii) If the base condition is met then the program gives meaningful output and exits.
(iii) Otherwise, function does some required processing and then calls itself to continue recursion. .
if n == 0:
return n * fact (n-1)
print (fact (0))
print (fact (5))