answer key sample paper class 12 computer science, Exercises of Computer science

term 1 answer key with this you can practice

Typology: Exercises

2024/2025

Available from 12/11/2024

gomathivetrivel
gomathivetrivel 🇮🇳

28 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
OXALISS INTERNATIONAL SCHOOL (CBSE), THATCHUR.
Computer Science (083)
TERM I EXAMINATIONS 2024-25
ANSWER KEY
Class: XII Max. Marks: 70
Date : 23.09.2024 Time : 3 Hrs.
General Instructions:
This question paper contains 37 questions.
All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions
The paper is divided into 5 Sections- A, B, C, D and E.
Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
All programming questions are to be answered using Python Language only.
In case of MCQ, text of the correct answer should also be written.
SECTION – A
Q No. Section-A (21 x 1 = 21 Marks) Marks
1. Which of the following function calls can be used to invoke the below function
definition ?
def test(a, b, c, d)
a) Test(1, 2, 3, 4) b) Test(a = 1, 2, 3, 4)
c)Test(a = 1, b = 2, c = 3, 4) d) Test(a = 1, b = 2, c = 3, d = 4)
1
2. Which of the following function headers is correct?
a) def f(a = 1, b): b) def f(a = 1, b, c = 2):
c) def f(a = 1, b = 1, c = 2): d) def f(a = 1, b = 1, c = 2, d):
1
3. Consider the code given below:
Which of the following statements should be given in the blank for #Missing
Statement, if the output produced is 110? Options:
a. global a b. global b=100 c. global b d. global a=100
1
4. Which of the following keywords marks the beginning of the function block?
a) func b) define c) def d)function
1
5. Pick one the following statements to correctly complete the function body in the
given code snippet.
def f(number):
#Missing function body
print(f(5))
a) return "number" b) print(number) c) print("number") d) return number
1
6. What will be the output of the following code?
c = 10
def add():
global c
c = c + 2
print(c,end='#')
1
pf3
pf4
pf5

Partial preview of the text

Download answer key sample paper class 12 computer science and more Exercises Computer science in PDF only on Docsity!

OXALISS INTERNATIONAL SCHOOL (CBSE), THATCHUR.

Computer Science (083)

TERM I EXAMINATIONS 2024-

ANSWER KEY

Class: XII Max. Marks: 70

Date : 23.09.2024 Time : 3 Hrs.

General Instructions:  This question paper contains 37 questions.  All questions are compulsory. However, internal choices have been provided in some questions. Attempt only one of the choices in such questions  The paper is divided into 5 Sections- A, B, C, D and E.  Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.  Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.  Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.  Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.  Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.  All programming questions are to be answered using Python Language only.  In case of MCQ, text of the correct answer should also be written. SECTION – A Q No. Section-A (21 x 1 = 21 Marks) Marks

  1. Which of the following function calls can be used to invoke the below function definition? def test(a, b, c, d) a) Test(1, 2, 3, 4) b) Test(a = 1, 2, 3, 4) c)Test(a = 1, b = 2, c = 3, 4) d) Test(a = 1, b = 2, c = 3, d = 4)
  1. (^) Which of the following function headers is correct? a) def f(a = 1, b): b) def f(a = 1, b, c = 2): c) def f(a = 1, b = 1, c = 2): d) def f(a = 1, b = 1, c = 2, d):
  1. (^) Consider the code given below: Which of the following statements should be given in the blank for #Missing Statement, if the output produced is 110? Options: a. global a b. global b=100 c. global b d. global a=
  1. Which of the following keywords marks the beginning of the function block? a) func b) define c) def d)function
  1. Pick one the following statements to correctly complete the function body in the given code snippet. def f(number): #Missing function body print(f(5)) a) return "number" b) print(number) c) print("number") d) return number
  1. What will be the output of the following code? c = 10 def add(): global c c = c + 2 print(c,end='#')

add() c= print(c,end='%') (A) 12%15# (B) 15#12% (C) 12#15% (D) 12%15#

  1. Write a Python statement to open a text file “DATA.TXT” so that new contents can be written on it. Ans.: fp=open(“DATA.TXT”,w)
  1. Which of the following functions changes the position of file pointer and returns its new position? a.flush() b.tell() c.seek() d.offset()
  1. What is the significance of adding “+‟ with file opening mode, with context to “r+‟? Ans.: “+” is used to add alternate action with specified mode. i.e., if used with “r” as “r+” it means it will allows to read and alternate action write.
  1. Which module will be used for binary file? Ans.: pickle module
  1. List out the functions supported by pickle module. Ans.: dump() and load()
  1. Convert the following Arithmetic expression into Postfix form: A-B-DE/F+BC Ans.: AB-DE-F/-BC+
  1. Which of the following expressions evaluates to False? (A) not(True) and False (B) True or False (C) not(False and True) (D) True and not(False)
  1. Stack structure is following LIFO principle. 1
  2. While popping the element from the stack, a condition will be raised, this condition is known as ____________. a) Underflow b) Overflow c) List is Empty d) Blank List
  1. The HAVING clause does which of the following? a) Acts EXACTLY like a WHERE clause. b) Acts like a WHERE clause but is used for columns rather than groups. c) Acts like a WHERE clause but is used for groups rather than rows. d) Acts like a WHERE clause but is used for rows rather than columns.
  1. SQL applies conditions on the groups through ............... clause after groups have been formed. a)Group by b) With c) Where d) Having
  1. Which of the following is not an aggregate function? a) Avg b) Sum c) With d)Min
  1. Which function used to check the connection? is_connect() Ex.: con.is_connected() if it returns True connection made successfully. If False not.

Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct choice as: (A) Both A and R are true and R is the correct explanation for A (B) Both A and R are true and R is not the correct explanation for A (C) A is True but R is False (D) A is False but R is True

  1. Assertion (A):- If the arguments in function call statement match the number and order of arguments as defined in the function definition, such arguments are called positional arguments. Reasoning (R):- During a function call, the argument list first contains default argument(s) followed by positional argument(s). Ans.: (C) A is True but R is False
  1. Assertion (A): A SELECT command in SQL can have both WHERE and HAVING clauses. Reasoning (R): WHERE and HAVING clauses are used to check conditions, therefore, these can be used interchangeably. Ans.: (C) A is True but R is False
  1. Write the SQL statement do we use to find out how many students took each exam?
  2. Write the SQL statement to display the count of fname group by exam id.

Q No. Section-C ( 3 x 3 = 9 Marks) Marks

  1. Write a function INDEX_LIST(L), where L is the list of elements passed as argument to the function. The function returns another list named ‘indexList’ that stores the indices of all Non-Zero Elements of L. For example: If L contains [12,4,0,11,0,56] The indexList will have - [0,1,3,5]
  1. What will be the output of following code? def Alter(M,N=50): M = M + N N = M - N print(M,"@",N) return M A= B= A = Alter(A,B) print(A,"#",B) B = Alter(B) print(A,‟@‟,B)

OR

What will be the output of following code? def Fun1(mylist): for i in range(len(mylist)): if mylist[i]%2==0: mylist[i]/= else: mylist[i]*= list1 =[21,20,6,7,9,18,100,50,13] Fun1(list1) print(list1)

  1. Write functions AddPlayer(player) and DeletePlayer(player) in python to add and remove a player by considering them as push and pop operations in a stack.

OR

Vedika has created a dictionary containing names and marks as key-value pairs of 5 students. Write a program, with separate user-defined functions to perform the following operations:

  1. Push the keys (name of the student) of the dictionary into a stack, where the corresponding value (marks) is greater than 70.
  1. Pop and display the content of the stack. Q No. SECTION D (4 X 4 = 16 Marks) Marks
  2. Vedansh is a Python programmer working in a school. For the Annual Sports Event, he has created a csv file named Result.csv, to store the results of students in different sports events. The structure of Result.csv is : [St_Id, St_Name, Game_Name, Result] Where St_Id is Student ID (integer) ST_name is Student Name (string) Game_Name is name of game in which student is participating(string) Result is result of the game whose value can be either 'Won', 'Lost' or 'Tie' For efficiently maintaining data of the event, Vedansh wants to write the following user defined functions: Accept() – to accept a record from the user and add it to the file Result.csv. The column headings should also be added on top of the csv file. wonCount() – to count the number of students who have won any event. As a Python expert, help him complete the task.
  1. A csv file "Happiness.csv" contains the data of a survey. Each record of the file contains the following data: ● Name of a country ● Population of the country ● Sample Size (Number of persons who participated in the survey in that country) ● Happy (Number of persons who accepted that they were Happy) For example, a sample record of the file may be: [‘Signiland’, 5673000, 5000, 3426] Write the following Python functions to perform the specified operations on this file: (I) Read all the data from the file in the form of a list and display all those records for which the population is more than 5000000. (II) Count the number of records in the file.

 The details (RollNo, Name, Clas and Marks) are to be accepted from the user. Write the following missing statements to complete the code: Statement 1 – to form the cursor object Statement 2 – to execute the command that inserts the record in the table Student. Statement 3- to add the record permanently in the database import mysql.connector as mysql def sql_data(): con1=mysql.connect(host="localhost",user="root",password="tiger",database="school" ) mycursor=_________________ #Statement 1 rno=int(input("Enter Roll Number :: ")) name=input("Enter name :: ") clas=int(input("Enter class :: ")) marks=int(input("Enter Marks :: ")) querry="insert into student values({},'{}',{},{})".format(rno,name,clas,marks) ______________________ #Statement 2 ______________________ # Statement 3 print("Data Added successfully") ************************ ALL THE BEST **************************