0% found this document useful (0 votes)
12 views8 pages

Xii Cs Program Question Material

The document outlines various topics in computer science for XII grade, covering chapters 1 to 16 with questions related to functions, control structures, Python functions, strings, lists, tuples, classes, SQL, and data visualization. Each chapter includes multiple choice questions, syntax, and programming tasks to assess understanding of the concepts. The document is prepared by B. Mohamed Yousuf and is intended for students at Dr. Suresh Matric HR Sec School in Ramanathapuram District.

Uploaded by

parkourpeter394
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)
12 views8 pages

Xii Cs Program Question Material

The document outlines various topics in computer science for XII grade, covering chapters 1 to 16 with questions related to functions, control structures, Python functions, strings, lists, tuples, classes, SQL, and data visualization. Each chapter includes multiple choice questions, syntax, and programming tasks to assess understanding of the concepts. The document is prepared by B. Mohamed Yousuf and is intended for students at Dr. Suresh Matric HR Sec School in Ramanathapuram District.

Uploaded by

parkourpeter394
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

Xii computer science programs related topics only

CHAPTER 1 TO 16 two marks


CHAPTER – 1( FUNCTION )
1. Which of the following is a normal function definition and which is recursive function definition
i) let sum x y: ii) let disp : iii) let rec sum num:
return x + y print ‘welcome’ if (num!=0) then return num + sum (num-1)
else return num
CHAPTER – 6( CONTROL STRUCTURES )
1. Write is the syntax of if.. else statement
2. Write range () syntax.
3. What is the output of the following python code? [M-2025]
for x in range(5,20,5):
print (x, end=’ ‘)
4. What is the output of following python code. (J-2025)
for x in (10, 20, 30):
print (“Hello World”)
CHAPTER – 7( PYTHON FUNCTIONS )
1. How to set the limit for recursive function? Give an example. (PTA-5)
2. Write a syntax of creating User defined Function in Python. (PTA-1)
CHAPTER – 8( STRINGS AND STRING MANIPULATION )
1. What will be the output of the following python code? (J-2022, 25) *
str1 = “School”
print(str1*3)
2. Write the general format of replace ( ) (S-2020)
3. What will be the output of the given python. str= “COMPUTER SCIENCE” (M-2020) *
a) print(str*2) b) print (str[0:7] )
4. What is the output of the following python code? str1=’WELCOME’ [M-2025] *
a) print ([Link]()) b) print ([Link]())
5. What is the positive and negative subscript value of the character ‘h’ in string ‘school’? (PTA-5)
6. Write the general format of slicing operation? (PTA-6)
7. Examples of swap case() (PTA-3)
8. What is the output of the following python code? str1=”welcome” [J-2025] *
print ([Link]()) print ([Link]())
CHAPTER – 9( LISTS, TUPLES, SETS AND DICTIONARY)
1. What will be the value of x in following python code?
List1=[2,4,6[1,3,5] ]
x=len(List1)
print(x)
2. Write the syntax of creating a Tuple with n number of elements. (M-2022)
3. Write the syntax to create a list with suitable example. (S-2020)
4. What will be output of the python code? (M-2023)
Squares = [x**2 for x in range (1,11)]
print (Squares)
5. Write the use of pop () function in Python. (M-2024) *
6. Write the syntax of Dictionary creation. (PTA-1)
7. What will be output of the following snippet? (PTA-2)
Mydict={chr(x):x for x in range(97,102)}
Print(Mydict)

1
PREPARED BY..., [Link] YOUSUF M.C.A., [Link].., (PG ASST IN COMPUTER SCIENCE)
DR SURESH MATRIC HR SEC SCHOOL – RAMANATHAPURAM DISTRICT
8. What will be output of the following snippet? (PTA-3)
set_A={'A', 2, 4, 'D'}
set_B={'A', 'B', 'C', 'D'}
print(set_A & set_B)
9. What will be output of the following snippet? (PTA-5)
alpha=list(range(65,70))
for x in alpha
print(chr(x), end=’\t’)
10. Consider the following tuple declaration: (PTA-6)
>>> Mytuple=tuple([x**2 for x in range(2,11,2)])
What will be the output of the following print statements?
1. Print(mytuple[2:3]) 2. Print(mytuple[3:]) 3. Print(mytuple[:])
CHAPTER – 10 ( PYTHON CLASSES AND OBJECTS )
1. What is the output of the following program?
Class Sample:
__num=10 10
def disp(self):
print(self.__num)
S=Sample()
[Link]()
print(S.__num)
2. Write the syntax of class instantiation. (PTA-5)
CHAPTER – 12( STRUCTURED QUERY LANGUAGE )
1. Write a query that selects all students whose age is less than 18 in order wise. (J-2025)
2. Which component of SQL lets insert values in tables and which lets to create a table? (M-2025)
CHAPTER – 13( PYTHON AND CSV FILES )
1. Mention the default modes of the File. (M-2023)
2. How will you sort more than one column from a CSV file? Give an example statement.
CHAPTER – 14( IMPORTING C++ PROGRAMS IN PYTHON )
1. What is the use of cd command? Give an example. (M-2025)
2. Write the syntax of [Link] method (M-2022)
CHAPTER – 15 (DATA MANIPULATION THROUGH SQL)
1. Which method is used to connect a database? Give an example.
2. Write the command to populate record in a table. Give an example.
3. Which method is used to fetch all rows from the database table? (J-2022, M-2024)
CHAPTER – 16( DATA VISUALIZATION USING PYPLOT: LINE , PIE AND BAR CHAT )
1. How will you install Mat plot lib? (M-2025)

CHAPTER 1 TO 16 THREE MARKS


CHAPTER – 2 ( DATA ABSTRACTION )
1. Identify Which of the following are constructors and selectors?
(a) N1:=number( )
(b) accetnum(n1)
(c) displaynum(n1)
(d) eval(a/b)
(e) x,y:= makeslope (m), makeslope(n) (f) display( )
2. Identify Which of the following are List, Tuple and class?
(a) arr [1, 2, 34]
(b) arr (1, 2, 34)
(c) student [rno, name, mark]
(d) day:= (‘sun’, ‘mon’, ‘tue’, ‘wed’)
(e) x:= [2, 5, 6.5, [5, 6], 8.2] (f) employee [eno, ename, esal, eaddress]
2
PREPARED BY..., [Link] YOUSUF M.C.A., [Link].., (PG ASST IN COMPUTER SCIENCE)
DR SURESH MATRIC HR SEC SCHOOL – RAMANATHAPURAM DISTRICT
(CHAPTER-3)( SCOPING )
1. Identify the scope of the variables in the following pseudo code and write its: output.
color:= Red
mycolor():
b:=Blue
myfavcolor():
g:=Greenprintcolor, b, g
myfavcolor()
print color, b
mycolor()
print color
CHAPTER – 5( PYTHON - VARIABLES AND OPERATORS)
1. Arithmetic operator with examples. (S-2021, M-2022, J-2025)
2. What are the assignment operators that can be used in Python? (M-2025)
3. Explain Ternary operator with examples. (M-2020, M-2023, PTA-1)
4. Write short notes on Escape sequences with examples. (J-2024)
CHAPTER – 6 ( CONTROL STRUCTURES )
1. Write a program to display. (M-2022)
A (OR) 1 (OR) *****
AB 12 ****
AB C 123 ***
AB C D 1234 **
AB C D E 12345 *
2. if.. else structure. syntax example with output (J-2023)
3. Using if.. else.. elif statement write a suitable program to display largest of 3 numbers. (M-2024)
4. Write the syntax of while loop. (J-2022, M-2023, J-2024, PTA-2, PTA-3)
5. Write the syntax of Nested if elif .else statement with example. (S-2020)
6. Draw a flow chart to explain while loop (PTA-2)
CHAPTER – 7 ( PYTHON FUNCTIONS )
1. ceil () and floor () function examples. (M-2023, M-2025)
2. Write a Python code to check whether a given year is leap year or not. (J-2023) *
3. Give some examples of i) MAX () function ii) MIN () function (J-2023)
CHAPTER – 8 ( STRINGS AND STRING MANIPULATION )
1. Write a Python program to display the given pattern. (M-2023)
COMPUT ER (OR) C
COMPUT E CO
COMPUT COM
COMPU COMP
COMP COMPU
COM COMPUT
CO COMPUT E
C COMPUT ER
2. Write a short about the followings with suitable example.
(a)capitalize() (b) swap case() (S-2020, M-2024, PTA-1, 3)
3. What will be the output of the given python program?
str1 = "welcome"
str2 = "to school"
str3=str1[:2]+str2[len(str2)-2:]
print(str3)
4. Examples of format ( )?
5. Examples of count () function in python.

3
PREPARED BY..., [Link] YOUSUF M.C.A., [Link].., (PG ASST IN COMPUTER SCIENCE)
DR SURESH MATRIC HR SEC SCHOOL – RAMANATHAPURAM DISTRICT
6. What will be the output of the given Python program? (S-2020) *
a = "Computer"
b = "Science"
x = a[:4] +b[len(b)-3:]
print(x)
7. Syntax with examples of string formatting operators? (PTA-6)
8. Examples of membership operators (PTA-2)
9. What will be the output of the given python program? str1=”THOLKAPPIYAM” (PTA-4)
[Link](str1[4:]) [Link](str1[4::2]) [Link](str1[::3]) [Link](str1[::-3])
10. What will be output of the following python program?
str1 = "welcome"
str2 = "to school"
str3 = str1[:3]+str2[len(str2)-1:]
print(str3)
11 Examples of find() function? (PTA-4, PTA-5)
CHAPTER – 9 ( LISTS, TUPLES, SETS AND DICTIONARY )
1. Syntax with example of sort( ) (J-2024)
2. What will be the output of the following code? (M-2020)
list = [2**x for x in range(5)]
print(list)
3. What will be the output of the following code? (M-2020)
list = [3**x for x in range(5)]
print(list)
4. Write the syntax of the following python list functions (i) remove () (ii) pop() (iii) clear () [M-2025]
5. What will be the output of the following python code? (M-2025)
squares=[ ]
for x in range (1,6):
s=x**2
squares. append(s)
print (squares)
6. What will be the output of the following python program? (PTA-4)
N= [ ]
for x in range(1,11):
[Link](x)
Num=tuple(N)
Print(N)
for index,i in enumerate(N):
if(i%2==1):
del(N[index])
print(N)
7. What will be the output of the following snippet? (PTA-5)
alpha =list(range(65,70))
for x in alpha:
print(chr(x), end=’\t’)
8. Write a simple python program with list of five marks and print the sum of all the marks using while loop (PTA-5)
9. Write the syntax of following python list functions i) append () ii) extend () iii) insert () (J-2025)
CHAPTER – 10 ( PYTHON CLASSES AND OBJECTS )
1. How do you define class members? (S-2021, PTA-1)
2. Write a class with two private class variables and print the sum using a method.

4
PREPARED BY..., [Link] YOUSUF M.C.A., [Link].., (PG ASST IN COMPUTER SCIENCE)
DR SURESH MATRIC HR SEC SCHOOL – RAMANATHAPURAM DISTRICT
3. Find the error in the following program to get the given output?
class Fruits:
def __init__(self, f1, f2):
self.f1=f1
self.f2=f2
def display(self):
print("Fruit 1 = %s, Fruit 2 = %s" %(self.f1, self.f2))
F = Fruits ('Apple', 'Mango')
del [Link]
[Link]()
Output :Fruit 1 = Apple, Fruit 2 = Mango
4. What is the output of the following program? (J-2022, J-2022) *
class Greeting:
def __init__(self, name):
self.__name = name
def display(self):
print("Good Morning ", self.__name)
obj=Greeting('BinduMadhavan')
[Link]()
5. How do define constructor and destructor in Python? (M-2024, PTA-4)
6. What is the output of the following program? (M-2020) *
class Greeting:
def __init__(self, name):
self.__name = name
def display(self):
print("Welcome to ", self.__name)
obj=Greeting('Python Programming')
[Link]()
CHAPTER – 11 ( DATABASE CONCEPTS )
1. Example of Cartesian Product (M-2025, PTA-5)
CHAPTER – 12( STRUCTURED QUERY LANGUAGE )
1. Write a SQL statement to modify the student table structure by adding a new field. (J-2022)
2. Write Save point command with an example.
3. Write a SQL statement using DISTINCT keyword. (M-2022)
CHAPTER – 13 ( PYTHON AND CSV FILES )
1. Write a Python program to modify an existing file. (J-2022)
2. Write a Python program to read a CSV file with default delimiter comma (,)
CHAPTER – 14 ( IMPORTING C++ PROGRAMS IN PYTHON )
1. Identify the module, operator, definition name for the following:Welcome . display() (J-2022)
2. Write about the steps of python program executing C++ program using control statement (M-2023)*
CHAPTER – 15 (DATA MANIPULATION THROUGH SQL)
1. Read the following details. Based on that write a python script to display department wise record.
Database name :-[Link]
Table name :-Employee
Columns in the table :- Eno, EmpName, Esal,Dept
2. Read the following details. Based on that write a python script to display records in descending order of eno.
Database name :-[Link]
Table name :-Employee
Columns in the table :- Eno, EmpName, Esal, Dept
3. Write a python code to create a database in SQLite. (PTA-3)

5
PREPARED BY..., [Link] YOUSUF M.C.A., [Link].., (PG ASST IN COMPUTER SCIENCE)
DR SURESH MATRIC HR SEC SCHOOL – RAMANATHAPURAM DISTRICT
CHAPTER – 16 ( DATA VISUALIZATION USING PYPLOT: LINE , PIE AND BAR CHAT )
1. Draw the output for the following data visualization plot.
import [Link] as plt
[Link]([1,3,5,7,9],[5,2,7,8,2], label=”Example one”)
[Link]([2,4,6,8,10],[8,6,2,5,6], label=”Example two”, color=’g’)
[Link]()
[Link](‘bar number’)
[Link](‘bar height’)
[Link](‘Epic Graph\nAnother Line! Whoa’)
[Link]()
2. Write the plot for the following pie chart output:

3. Draw the output for the following Python code. (PTA-3)


import [Link] as plt
x = [1,2,3]
y = [5,7,4]
x2 = [1,2,3]
y2 = [10,14,12]
[Link](x, y, label='Line 1')
[Link](x2, y2, label='Line 2')
[Link]('X-Axis')
[Link]('Y-Axis')
[Link]('LINE GRAPH')
[Link]()
[Link]()

CHAPTER 1 TO 16 FIVE MARKS


1. Identify in the following program.
let rec gcd a b :=
ifletb <>
rec 0gcd a bgcd
then := b (a mod b) else return
if b <> 0 then gcd b (a mod b) else return

i) Name of the function.


ii) Identify the statement which tells it is a recursive function.
iii) Name of the argument variable.
iv) Statement which invoke the function recursively.
v) Statement which terminates the recursion
CHAPTER – 6 ( CONTROL STRUCTURES )
1. Write a detail note on for loop. (J-2020, S-2021, M-2022, J-2022, J-2024)
2. Write a syntax of if..else..elif statement with suitable example. (S-2020, PTA-3)
6
PREPARED BY..., [Link] YOUSUF M.C.A., [Link].., (PG ASST IN COMPUTER SCIENCE)
DR SURESH MATRIC HR SEC SCHOOL – RAMANATHAPURAM DISTRICT
3. Write a program to display all 3 digit odd numbers. (M-2020)
4. Write a program to display multiplication table for a given number.
5. Write the output for the following python programs. (S-2020)
(i) j=15 ii) k=5
while(j>=10): while(k<=9):
Print(j,end=”\”) for i in range(1,k):
j=j-1 print(i, end=’\t’)
else: print(end=’\n’)
print(“\nEnd of the loop”) k=k+1
CHAPTER – 7 ( PYTHON FUNCTIONS )
1. Explain the following built-in functions. (M-2020, M-2023, PTA-4,6, J-2025)
(a) id() (b) chr() (c) round() (d) type() (e) pow()
2. Write a Python code to find the L.C.M. of two numbers.
3. Explain recursive function with an example. (M-2020, J-2024, M-2025, PTA-5)
4. Debug the following python program to get the given output. (S-2020)
Output:
Inside add() function x value is:10
In main x value is:10
Program:
x=10
define add:
globally x:
x = x+10
print (‘Inside add() function x value is:”)
add print (“In main x value is:”)
CHAPTER – 8( STRINGS AND STRING MANIPULATION )
1. What is output for following python command: str=”Thinking with python” (S-2021)
a)print(str[::3]) b)print(str[::-3]) c)print(str[9:13])
2. What will the output of the given python Snippet? str1=”Welcome to Python” (M-2020)
1) print(str1) 2)print(str 1[11:17] ) 3) print(str1[11:17:2]
4)print(str1[: : 4] 5) print(str1[: : - 4] )
CHAPTER – 9( LISTS, TUPLES, SETS AND DICTIONARY)
1. Write the output of the following: A={1,2,3,4,5} B={4,5,6,7,8} [M-2025]
i) print(A|B) ii) print(A&B) iii) print(A-B) iv) print(B&A) v) print(A^B)
2. Write execution table for the following python code. (PTA-1)
Marks = [10, 20, 30, 40, 50]
i=0
sum=0
while i < 4:
sum+=Marks[i]
i=i+1
3. What will the output of the following python program? (PTA-2, PTA-5)
A={x*3 for x in range(1,6)}
B={y**2 for y in range (1,10,2}
i) print(A)
ii) print(B)
iii) print(A|B)
iv) print(A-B
v) print(A&B)
vi) print(A^B)

7
PREPARED BY..., [Link] YOUSUF M.C.A., [Link].., (PG ASST IN COMPUTER SCIENCE)
DR SURESH MATRIC HR SEC SCHOOL – RAMANATHAPURAM DISTRICT
CHAPTER – 12 ( STRUCTURED QUERY LANGUAGE )
1. Consider the following employee table. Write SQL commands for the Questions. (i) to (v) . (PTA-2)
EMP CODE NAME DESIG PAY ALLOWANCE
S1001 Hariharan Supervisor 29000 12000
P1002 Shaji Operator 10000 5500
P1003 Prasad Operator 12000 6500
C1004 Manjima Clerk 8000 4500
M1005 Ratheesh Mechanic 20000 7000
1) To display the details of all employees in descending order of pay.
2) To display all employees whose allowance is between 5000 and7000.
3) To remove the employees who are mechanic.
4) To add a new row.
5) To display the details of all employees who are operators.
2. Construct the following SQL statements in the student table. (S-2020, M-2022)
3. Write a SQL statement to create a table for employee having any five fields and create a table
constraint for the employee table. (M-2020)
CHAPTER – 13 ( PYTHON AND CSV FILES )
1. Write a Python program to write a CSV File with custom quotes.
CHAPTER – 14( IMPORTING C++ PROGRAMS IN PYTHON )
1. Explain each word of the following command.
Python <[Link]> -<i><C++ filename without cpp extension> (M-2022)
CHAPTER – 15 (DATA MANIPULATION THROUGH SQL)
1. Write the Python script to display all the records of the following table using fetchmany () (S-2021, PTA-1)
Icode Item Name Rate
1003 Scanner 10500
1004 Speaker 3000
1005 Printer 8000
1008 Monitor 15000
1010 Mouse 700
2. Write a Python script to create a table called ITEM with following specification. Add one record to the table.
Name of the database :- ABC Name of the table :- Item
Column name and specification :-
Icode :- integer and act as primary key
Item Name :- Character with length 25
Rate :- Integer
Record to be added :- 1008, Monitor,15000
3. Consider the following table Supplier and item .Write a python script for (i) to (ii)
SUPPLIER
Suppno Name City Icode SuppQty
S001 Prasad Delhi 1008 100
S002 Anu Bangalore 1010 200
S003 Shahid Bangalore 1008 175
S004 Akila Hydrabad 1005 195
S005 Girish Hydrabad 1003 25
S006 Shylaja Chennai 1008 180
S007 Lavanya Mumbai 1005 325
i) Display Name, City and Itemname of suppliers who do not reside in Delhi:
ii) Increment the SuppQty of Akila by 40:
CHAPTER – 16 ( DATA VISUALIZATION USING PYPLOT: LINE , PIE AND BAR CHAT )
1. Explain the purpose of the following functions. (M-2022)
a. [Link] b. [Link] c. [Link] d. [Link]() e. [Link]()

8
PREPARED BY..., [Link] YOUSUF M.C.A., [Link].., (PG ASST IN COMPUTER SCIENCE)
DR SURESH MATRIC HR SEC SCHOOL – RAMANATHAPURAM DISTRICT

You might also like