Computer Science Sample Question Paper Class 12 Term-1 2022-23

Hello welcome to Darkrown.com👑
In this post you’re going to get Question Sample Paper📄 of Computer💻 Science🔬 for Class👩‍🏫 12th.
This Sample Paper📄 is from 2022-2023 Term-1 Examination📋.
I hope you like😍 the Sample paper the way I presented in the post.
By the way after a few day🤔 I’ll add📎 the PDF of the Sample paper, that you’ll be able to download📥 in future.

Class: XII Session: 2022-23
Computer Science (083)
Sample Question Paper (Theory)

Maximum Marks: 70
Time Allowed: 3 hours
General Instructions:

  1. This question paper contains five sections, Section A to E.
  2. All questions are compulsory.
  3. Section A has 18 questions carrying 01 mark each.
  4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
  5. Section C has 05 Short Answer type questions carrying 03 marks each.
  6. Section D has 03 Long Answer type questions carrying 05 marks each.
  7. Section E has 02 questions carrying 04 marks each. One internal choice is
    given in Q35 against part c only.
  8. All programming questions are to be answered using Python Language only.

Section A

Q.1: State True or False

“Variable declaration is implicit in Python.”

Ans: TRUE

(1 mark for the correct answer)

Q.2: Which of the following is an invalid datatype in Python?

(a) Set
(b) None
(c) Integer
(d) Real

Ans: (d) Real

(1 mark for the correct answer)

Q.3: Given the following dictionaries

dict_exam={"Exam":"AISSCE", "Year":2023}
dict_result={"Total":500, "Pass_Marks":165}

Which statement will merge the contents of both dictionaries?

(a) dict_exam.update(dict_result)
(b) dict_exam + dict_result
(c) dict_exam.add(dict_result)
(d) dict_exam.merge(dict_result)

Ans: (a) dict_exam.update(dict_result)

(1 mark for the correct answer)

Q.4: Consider the given expression:

not True and False or True

Which of the following will be correct output if the given expression is evaluated?

(a) True
(b) False
(c) NONE
(d) NULL

Ans: (a) True

(1 mark for the correct answer)

Q.5: Select the correct output of the code:

a = "Year 2022 at All the best"
a = a.split('2')
b = a[0] + ". " + a[1] + ". " + a[3]
print (b)

(a) Year . 0. at All the best
(b) Year 0. at All the best
(c) Year . 022. at All the best
(d) Year . 0. at all the best

Ans: (a) Year . 0. at All the best

(1 mark for the correct answer)

Q.6: Which of the following mode in file opening statement results or generates an error if the file does not exist?

(a) a+
(b) r+
(c) w+
(d) None of the above

Ans: (b) r+

(1 mark for the correct answer)

Q.7: Fill in the blank:

_____ command is used to remove primary key from the table in SQL.

(a) update
(b) remove
(c) alter
(d) drop

Ans: (c) alter

(1 mark for the correct answer)

Q.8: Which of the following commands will delete the table from MYSQL database?

(a) DELETE TABLE
(b) DROP TABLE
(c) REMOVE TABLE
(d) ALTER TABLE

Ans: (b) DROP TABLE

(1 mark for the correct answer)

Q.9: Which of the following statement(s) would give an error after executing the following code?

S="Welcome to class XII" # Statement 1
print(S)                 # Statement 2
S="Thank you"            # Statement 3
S[0]= '@'                # Statement 4
S=S+"Thank you"          # Statement 5

(a) Statement 3
(b) Statement 4
(c) Statement 5
(d) Statement 4 and 5

Ans: (b) Statement 4

(1 mark for the correct answer)

Q.10: Fill in the blank:

_____ is a non-key attribute, whose values are derived from the primary key of some other table.

(a) Primary Key
(b) Foreign Key
(c) Candidate Key
(d) Alternate Key

Ans: (b) Foreign Key

(1 mark for the correct answer)

Q.11: The correct syntax of seek() is:

(a) file_object.seek(offset [, reference_point])
(b) seek(offset [, reference_point])
(c) seek(offset, file_object)
(d) seek.file_object(offset)

Ans: (a) file_object.seek(offset [, reference_point])

(1 mark for the correct answer)

Q.12: Fill in the blank:

The SELECT statement when combined with _____ clause, returns records without repetition.

(a) DESCRIBE
(b) UNIQUE
(c) DISTINCT
(d) NULL

Ans: (c) DISTINCT

(1 mark for the correct answer)

Q.13: Fill in the blank:

______is a communication methodology designed to deliver both voice
and multimedia communications over Internet protocol.

(a) VoIP
(b) SMTP
(c) PPP
(d) HTTP

Ans: (a) VoIP

(1 mark for the correct answer)

Q.14: What will the following expression be evaluated to in Python?

print(15.0 / 4 + (8 + 3.0))

(a) 14.75
(b)14.0
(c) 15
(d) 15.5

Ans: (a) 14.75

(1 mark for the correct answer)

Q.15: Which function is used to display the total number of records from table in a database?

(a) sum(*)
(b) total(*)
(c) count(*)
(d) return(*)

Ans: (c) count(*)

(1 mark for the correct answer)

Q.16: To establish a connection between Python and SQL database, connect() is used. Which of the following arguments may not necessarily be given while calling connect() ?

(a) host
(b) database
(c) user
(d) password

Ans: (b) database

(1 mark for the correct answer)

17 and 18 are ASSERTION AND REASONING 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

Q.17:
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 mark for the correct answer)

Q.18:
Assertion (A): CSV (Comma Separated Values) is a file format for data storage which looks like a text file.
Reason (R): The information is organized with one record on each line and each field is separated by comma.

Ans: (a) Both A and R are true and R is the correct explanation for A

(1 mark for the correct answer)

Section B

Q.19: Rao has written a code to input a number and check whether it is prime or not. His code is having errors. Rewrite the correct code and underline the corrections made.

def prime():
  n=int(input("Enter number to check :: ")
  for i in range (2, n//2):
    if n%i=0:
      print("Number is not prime \n")
    break
    else:
      print("Number is prime \n’)

Ans:

def prime():
  n=int(input("Enter number to check :: ")) # bracket missing
  for i in range (2, n//2):
    if n%i==0:                              # = missing
      print("Number is not prime \n")
      break                                 # wrong indent
    else:
      print("Number is prime \n")           # quote mismatch

(½ mark for each correct correction made and underlined.)

Q.20:
Write two points of difference between Circuit Switching and Packet Switching.

Ans:

Circuit Switching Packet Switching
Circuit switching is the method of switching which is used for establishing a dedicated communication path between the sender and the receiver.Packet switching is the method of switching where no dedicated path is established from the source to the destination.
Data is processed and transmitted at the source only.Data is processed and transmitted, not only at the source but at each switching station.
It is more reliable. It is less reliable.

( 1 mark for each correct point of difference)

OR

Write two points of difference between XML and HTML.

Ans:
XML (Extensible Markup Langauge)

  • XML tags are not predefined, they are user defined.
  • XML stores and transfers data.
  • Dynamic in nature.

HTML (Hypertext Markup Langauge)

  • HTML tags are pre-defined and it is a markup language.
  • HTML is about displaying data.
  • Static in nature.

(1 mark for each correct difference – Any two)

Q.21:
(a) Given is a Python string declaration:

myexam="@@CBSE Examination [email protected]@"

Write the output of: print(myexam[::-2])

Ans: @20 otnmx [email protected]

(1 mark for the correct answer)

(b) Write the output of the code given below:

my_dict = {"name": "Aman", "age": 26}
my_dict['age'] = 27
my_dict['address'] = "Delhi"
print(my_dict.items())

Ans: dict_items([(‘name’, ‘Aman’), (‘age’, 27), (‘address’, ‘Delhi’)])

(1 mark for the correct answer)

Q.22: Explain the use of ‘Foreign Key’ in a Relational Database Management System. Give example to support your answer.

Ans:
A foreign key is used to set or represent a relationship between two relations (or tables) in a database. Its value is derived from the primary key attribute of another relation.

For example:

In the tables TRAINER and COURSE given below, TID is primary key in TRAINER table but foreign key in COURSE table.

TRAINER
TID TNAME CITY HIREDATE SALARY
101 Ritu Nagpur 1998-10-15 56700
102 Navin Goa 1994-12-24 80000
103 Murugan Chandigarh 2001-12-21 82000
104 Jyothi Guwahati 2002-12-25 68000
105 Chanu Mumbai 1996-01-12 95000
106 Arbaaz Delhi 2001-12-12 69000
COURSE
CID CNAME FEES STARTDATE TID
C201 Deepa 12000 2018-07-02 101
C202 Sindhu 15000 2018-07-15 103
C203 Neeraj 10000 2018-10-01 102
C204 Prakash 9000 2018-09-15 104
C205 Nikhat 20000 2018-08-01 101

(1 mark for explanation and 1 mark for example)
(Any relevant correct example may be marked)

Q.23:
(a) Write the full forms of the following:

(i) SMTP (ii) PPP

Ans:
(i) SMTP: Simple Mail Transfer Protocol
(ii) PPP: Point to Point Protocol

(½ mark for every correct full form)

(b) What is the use of TELNET?

Ans: TELNET is used to access a remote computer / network.

(1 mark for correct answer)

Q.24:
Predict the output of the Python code given below:

def Diff(N1,N2):
  if N1>N2:
    return N1-N2
  else:
    return N2-N1

NUM = [10,23,14,54,32]
for CNT in range (4, 0, -1):
  A=NUM[CNT]
  B=NUM[CNT-1]
  print(Diff(A,B),'#', end=' ')

Ans: 22 # 40 # 9 # 13 #

(½ mark for the correct digit with a #)

OR

Predict the output of the Python code given below:

tuple1 = (11, 22, 33, 44, 55, 66)
list1 = list(tuple1)
new_list = []
for i in list1:
  if i%2==0:
    new_list.append(i)
new_tuple = tuple(new_list)
print(new_tuple)

Ans: (22,44,66)

(½ mark for each correct digit , ½ mark for enclosing in parenthesis)

Q.25:
Differentiate between count() and count(*) functions in SQL with appropriate example.

Ans:
COUNT(*) returns the count of all rows in the table, whereas COUNT () is used with Column_Name passed as argument and counts the number of non-NULL values in a column that is given as argument.

Example:

Table: EMPL
EMPNO ENAME JOB SAL DEPTNO
8369 SMITH CLERK 2985 10
8499 ANYA NULL 9870 20
8566 AMIR SALESMAN 8760 30
8698 BINA MANAGER 5643 20
8912 SUR NULL 3000 10

e.g.1 SELECT COUNT(*) FROM EMPL;
Output

COUNT(*)
5

e.g.2 SELECT COUNT(JOB) FROM EMPL;
Output

COUNT(JOB)
3

Since JOB has 2 NULL values

(1 mark for the difference and 1 mark for appropriate example)

OR

Categorize the following commands as DDL or DML:
INSERT, UPDATE, ALTER, DROP

Ans:
DDL – ALTER, DROP
DML – INSERT, UPDATE

(½ mark for each correct categorization)

Section C

Q.26:
(a) Consider the following tables – Bank_Account and Branch:

Table: Bank_Account
ACodeNameType
A01AmritaSavings
A02ParthodasCurrent
A03MirabenCurrent
Table: Branch
ACodeCity
A01Delhi
A02Mumbai
A01Nagpur

What will be the output of the following statement?

SELECT * FROM Bank_Account NATURAL JOIN Branch;

Ans:

Acode Name Type City
A01 Amrita Savings Delhi
A01 Amrita Savings Nagpur
A02 Parthodas Current Mumbai

(1 mark for correct output)

(b) Write the output of the queries (i) to (iv) based on the table, TECH_COURSE given below:

Table: TECH_COURSE
CID CNAME FEES STARTDATE TID
C201 Animation and VFX 12000 2022-07-02 101
C202 CADD 15000 2021-11-15 NULL
C203 DCA 10000 2020-10-01 102
C204 DDTP 9000 2021-09-15 104
C205 Mobile Application Development 18000 2022-11-01 101
C206 Digital marketing 16000 2022-07-25 103
(i) SELECT DISTINCT TID FROM TECH_COURSE;

Ans:

DISTINCT TID
101
NULL
102
104
103

(½ mark for the correct output)

(ii) SELECT TID, COUNT(*), MIN(FEES) FROM TECH_COURSE GROUP BY TID HAVING COUNT(TID)>1;

Ans:

TID COUNT(*) MIN(FEES)
101 2 12000

(½ mark for the correct output)

(iii) SELECT CNAME FROM TECH_COURSE WHERE FEES>15000 ORDER BY CNAME;

Ans:

CNAME
Digital marketing
Mobile Application Development

(½ mark for the correct output)

(iv) SELECT AVG(FEES) FROM TECH_COURSE WHERE FEES BETWEEN 15000 AND 17000;

Ans:
15500.00

(½ mark for the correct output)

Q.27:
Write a method COUNTLINES() in Python to read lines from text file ‘TESTFILE.TXT’ and display the lines which are not starting with any vowel.

Example:

If the file content is as follows:

An apple a day keeps the doctor away.
We all pray for everyone’s safety.
A marked difference will come in our country.

The COUNTLINES() function should display the output as:

The number of lines not starting with any vowel: 1

Ans:

def COUNTLINES() :
  file = open ('TESTFILE.TXT', 'r')
  lines = file.readlines()
  count=0
  for w in lines :
    if (w[0]).lower() not in 'aeoiu'
      count = count + 1
  print ("The number of lines not starting with any vowel: ", count)
  file.close()

COUNTLINES()

(½ mark for correctly opening and closing the file
½ for readlines()
½ mark for correct loop
½ for correct if statement
½ mark for correctly incrementing count
½ mark for displaying the correct output)

OR

Write a function ETCount() in Python, which should read each character of a text file “TESTFILE.TXT” and then count and display the count of occurrence of alphabets E and T individually (including small cases e and t too).

Example:

If the file content is as follows:

Today is a pleasant day.
It might rain today.
It is mentioned on weather sites.

The ETCount() function should display the output as:

E or e: 6
T or t : 9

Ans:

def ETCount() :
  file = open ('TESTFILE.TXT', 'r')
  lines = file.readlines()
  countE=0
  countT=0
  for w in lines :
    for ch in w:
      if ch in 'Ee':
        countE = countE + 1
      if ch in 'Tt':
        countT=countT + 1
  print ("The number of E or e : ", countE)
  print ("The number of T or t : ", countT)
  file.close()

ETCount()

Note: Any other relevant and correct code may be marked

Q.28:
(a) Write the outputs of the SQL queries (i) to (iv) based on the relations Teacher and Placement given below:

Table: Teacher
T_IDNameAgeDepartmentDate_of_joinSalaryGender
1Arunan34Computer Sc2019-01-1012000M
2Saman31History2017-03-2420000F
3Randeep32Mathematics2020-12-1230000M
4Samira35History2018-07-0140000F
5Raman42Mathematics2021-09-0525000M
6Shyam50History2019-06-2730000M
7Shiv44Computer Sc2019-02-2521000M
8Shalakha33Mathematics2018-07-3120000F
Table: Placement
P_IDDepartmentPlace
1HistoryAhmedabad
2MathematicsJaipur
3Computer ScNagpur
(i) SELECT Department, avg(salary) FROM Teacher GROUP BY Department;

Ans:

Department Avg(Salary)
Computer Sc 16500.00
History 30000.00
Mathematics 25000.00

(½ mark for the correct output)

(ii) SELECT MAX(Date_of_Join), MIN(Date_of_Join) FROM Teacher;

Ans:

Max(Date_of_Join) Min(Date_of_Join)
2021-09-05 2017-03-04

(½ mark for the correct output)

(iii) SELECT Name, Salary, T.Department, Place FROM Teacher T, Placement P WHERE T.Department = P.Department AND Salary>20000;

Ans:

Name Salary Department Place
Randeep 30000 Mathematics Jaipur
Samira 40000 History Ahmedabad
Raman 25000 Mathematics Jaipur
Shyam 30000 History Ahmedabad
Shiv 21000 Computer Sc Nagpur

(½ mark for the correct output)

(iv) SELECT Name, Place FROM Teacher T, Placement P WHERE Gender =’F’ AND T.Department=P.Department;

Ans:

Name Place
Samira Ahmedabad
Suman Ahmedabad
Shalaka Jaipur

(½ mark for the correct output)

(b) Write the command to view all tables in a database.

Ans:
SHOW TABLES;

(1 mark for correct answer)

Q.29: 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]

Ans:

def INDEX_LIST(L):
  indexList=[]
  for i in range(len(L)):
    if L[i]!=0:
      indexList.append(i)
  return indexList

(½ mark for correct function header
1 mark for correct loop
1 mark for correct if statement
½ mark for return statement)
Note: Any other relevant and correct code may be marked

Q.30: A list contains following record of a customer:

[Customer_name, Phone_number, City]

Write the following user defined functions to perform given operations on the stack named ‘status’:

  1. Push_element() – To Push an object containing name and Phone number of customers who live in Goa to the stack
  2. Pop_element() – To Pop the objects from the stack and display them. Also, display “Stack Empty” when there are no elements in the stack.

For example:

If the lists of customer details are:

[“Gurdas”, “99999999999”, ”Goa”]
[“Julee”, “8888888888”, ”Mumbai”]
[“Murugan”, “77777777777”, “Cochin”]
[“Ashmit”, “1010101010”, “Goa”]

The stack should contain:
[“Ashmit”, “1010101010”]
[“Gurdas”, “9999999999”]

The output should be:
[“Ashmit”, “1010101010”]
[“Gurdas”, “9999999999”]
Stack Empty

Ans:

status=[]

def Push_element(cust):
  if cust[2]=="Goa":
    L1=[cust[0],cust[1]]
    status.append(L1)

def Pop_element ():
  num=len(status)
  while len(status)!=0:
    dele=status.pop()
    print(dele)
    num=num-1
  else:
    print("Stack Empty")

(1.5 marks for correct push_element() and 1.5 marks for correct pop_element())

OR

Write a function in Python, Push(SItem) where , SItem is a dictionary containing the details of stationary items- {Sname:price}.
The function should push the names of those items in the stack who have price greater than 75. Also display the count of elements pushed into the stack.

For example:
If the dictionary contains the following data:

Ditem = {“Pen”:106, “Pencil”:59, “Notebook”:80, “Eraser”:25}

The stack should contain:
Notebook
Pen

The output should be:
The count of elements in the stack is 2

Ans:

stackItem=[]
def Push(SItem):
  count=0
  for k in SItem:
    if (SItem[k]>=75):
      stackItem.append(k)
      count=count+1
  print("The count of elements in the stack is : ", count)

(1 mark for correct function header
1 mark for correct loop
½ mark for correct If statement
½ mark for correct display of count)

I check🔎 each question❓ one by one and keep adding📎. So that no question and answer is wrong❌. This means you can bookmark📑 this site Darkrown.com for further questions.

And till then you can also visit the rest of the question paper📄.

Apart from this, if you have found🔎 any mistake😓 in the Sample Question Paper, then do comment and tell😌.
I will rectify the mistake❎ as soon as possible👍.

And when all the questions❓❓❓ are solved☑️ then I will also give the link of PDF file📁.

Ok then see you in the next post till then b-bye🙋‍♂️

Leave a Reply

Your email address will not be published. Required fields are marked *