I will provide you with Important PYQs Computer Science Class 12 in this article. So let us start discussing Important PYQs Computer Science Class 12.

Why to practice Important PYQs Computer Science Class 12?

Important PYQs Computer Science Class 12 are very crucial to ace your computer science class 12 theory exams. Here are few reasons:

Practicing Important PYQs (Previous Year Questions) for Computer Science Class 12 is highly beneficial for several reasons:

  1. Exam Pattern Familiarity
    • PYQs help you understand the types of questions that are frequently asked.
    • They give insights into the marking scheme and weightage of different topics.
  2. Concept Clarity
    • By solving past questions, you reinforce key concepts and improve problem-solving skills.
    • It helps identify strong and weak areas in your syllabus.
  3. Time Management
    • Regular practice improves your speed and accuracy during exams.
    • You learn how to allocate time for different sections effectively.
  4. Boosts Confidence
    • Solving PYQs reduces exam anxiety as you get familiar with question patterns.
    • It increases your confidence in tackling different types of questions.
  5. Identifies Important Topics
    • Certain topics are repeatedly asked in exams, indicating their importance.
    • Practicing PYQs helps you focus more on high-weightage topics.
  6. Improves Answer Writing Skills
    • You learn how to structure answers efficiently to maximize marks.
    • Practicing coding questions enhances programming skills and logic-building.
  7. Reduces Surprise Element
    • Since many questions are repeated in board exams, solving PYQs increases the chances of encountering familiar questions.

So let start with Important PYQs Computer Science Class 12. Here we go!

1 mark questions

As per the CBSE Sample Paper and Previous Year’s question papers, 1-mark questions are an important element of board exams. Let us start with 1-mark questions which include fill-in-the-blank, MCQs, True/False, one-word answers, and all sorts of very short answer types questions. Here we go!

[1] State True or False : “In Python, tuple is a mutable data type”.

[2] The primary key is selected from the set of _____________.
(A) composite keys

(B) alternate keys

(C) candidate keys

(D) foreign keys

[3] What will be the output of the following statement?

print(6+5/4**2//5+8)

(A) –14.0

(B) 14.0

(C) 14

(D) –14

[4] Select the correct output of the code:

S = "text#next"
print(S.strip("t"))

(A) ext#nex

(B) ex#nex

(C) text#nex

(D) ext#next

[5] In SQL, which command will be used to add a new record in a table?
(A) UPDATE
(B) ADD
(C) INSERT
(D) ALTER TABLE

[6] ‘L’ in HTML stands for:

(A) Large

(B) Language

(C) Long

(D) Laser

[7] Identify the valid Python identifier from the following:
(A) 2user

(B) user@2

(C) user_2

(D) user 2

[8] Consider the statements given below and then choose the correct output from the given options:

Game="World Cup 2023"
print(Game[-6::-1])

(A) CdrW

(B) ce o

(C) puC dlroW

(D) Error

Explanation:

Step 1: Understanding Negative Indexing

The string assigned to Game is:

Game="World Cup 2023"

Index positions of each character:

WorldCup2023
Forward Indexes012345678910111213
Backward Indexes-14-13-12-11-10-9-8-7-6-5-4-3-2-1

Step 2: Evaluating Game[-6::-1]

  • Game[-6] → The character at index -6 is 'p'.
  • [::-1] → This means we are slicing in reverse order (from right to left).
  • Game[-6::-1] → Start at 'p' (index -6) and go backward until the beginning.

[9] Predict the output of the following Python statements:

import statistics as s
s.mode ([10, 20, 10, 30, 10, 20, 30])

(A) 30
(B) 20
(C) 10
(D) 18.57

[10] Which of the following output will never be obtained when the given code is executed?

import random
Shuffle = random.randrange(10)+1
Draw = 10*random.randrange(5)
print ("Shuffle", Shuffle, end="#")
print ("Draw", Draw)

(A) Shuffle 1 # Draw 0
(B) Shuffle 10 # Draw 10
(C) Shuffle 10 # Draw 0
(D) Shuffle 11 # Draw 50

[11] Ethernet card is also known as :
(A) LIC

(B) MIC

(C) NIC

(D) OIC

[12] What will be the output of the given code?

a=10
def convert(b=20):
  a=30
  c=a+b
  print(a,c)
convert(30)
print(a)

[13] For the following Python statement :
N = (25)
What shall be the type of N?
(A) Integer
(B) String
(C) Tuple
(D) List

[14] Mr. Ravi is creating a field that contains alphanumeric values and fixed lengths. Which MySQL data type should he choose for the same?
(A) VARCHAR
(B) CHAR
(C) LONG
(D) NUMBER

[15] Fill in the blank : The full form of WWW is _______________________.

[16] ___________ files are stored in a computer in a sequence of bytes.
(A) Text
(B) Binary
(C) CSV
(D) Notepad


[17] Assertion (A) : Global variables are accessible in the whole program.
Reason (R) : Local variables are accessible only within a function or block in which it is declared.

(A) Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation of Assertion (A).
(B) Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of Assertion (A).
(C) Assertion (A) is true, but Reason (R) is false.
(D) Assertion (A) is false, but Reason (R) is true.

[18] Assertion (A) : If numeric data are to be written to a text file, the data needs to be converted into a string before writing to the file.
Reason (R) : write() method takes a string as an argument and writes it to the text file.
(A) Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation of Assertion (A).
(B) Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of Assertion (A).
(C) Assertion (A) is true, but Reason (R) is false.
(D) Assertion (A) is false, but Reason (R) is true.

[19] State True or False: While defining a function in Python, the positional parameters in the function header must always be written after the default parameters.

[20] The SELECT statement when combined with ___________ the clause, returns records without repetition.

(a) DISTINCT 

(b) DESCRIBE

(c) UNIQUE

(d) NULL

[21] What will be the output of the following statement: print(16*5/4*2/5-8)

(a) -3.33          

(b) 6.0

(c) 0.0 

(d) -13.33

[22] What possible output from the given options is expected to be displayed when the following Python code is executed?

import random
Signal=['RED','YELLOW','GREEN']
for K in range(2,0,-1):
  R = random.randrange(K)
  print(Signal[R], end='#')

(a) YELLOW # RED #           

(b) RED # GREEN #

(c) GREEN # RED #   

(d) YELLOW # GREEN #

[23] In SQL, the aggregate function which will display the cardinality of the table is:

(a) sum()

(b) count(*)

(c) avg()

(d) sum(*)

[24] Which protocol out of the following is used to send and receive emails over a computer network?   

(a) PPP                        

(b) HTTP

(c) FTP     

(d) SMTP

[25] Identify the invalid Python statement from the following :  

(a) d = dict()

(b) e = {}

(c) f = []

(d) g = dict{ }

Watch this video to learn more:

[26] Consider the statements given below and then choose the correct output from the given options :

myStr="MISSISSIPPI"
print(myStr : 4] +" # " + myStr [—5 : ] )

(a) MISSI#SIPPI              

(b) MISS#SIPPI

(c) MISS#IPPIS 

(d) MISSI#IPPIS

[27] Identify the statement from the following which will raise an error:

(a) print ( “A” *3)           

(b) print (5*3)

(c) print (“15” + 3)

(d) print ( ” 15″ + “13” )

[28] Select the correct output of the following code :  

event="G20 Presidency@2023"
L=event.split(' ')
print (L [ : : —2] )

(a) ‘G20’

(b) [‘Precsidency@2023’]

(c) [ ‘ G20 ‘ ]

(d)  ‘Presidency@2023’

[29] Which of the following options is the correct unit of measurement for network bandwidth?

(a) KB                         

(b) Bit

(c) Hz

(d) Km

[30] Observe the given Python code carefully : 

a=20 
def convert (a) :

    b=20 
    a=a+b
convert (10) 
print (a)

Select the correct output from the given options :

(a) 10                    

(b) 20

(c) 30  

(d) Error

[31] State whether the following statement is True or False : While handling exceptions in Python, name of the exception has to be compulsorily added with except clause.

[32] Which of the following is not a DDL command in SQL?  

(a) DROP                       

(b) CREATE

(c) UPDATE

(d) ALTER

[33] Fill in the blank :  ___________ is a set of rules that needs to be followed by the communicating

parties in order to have a successful and reliable data communication over a network.

[34] Consider the following Python statement :     

F=open ( ‘ CONTENT . TXT ‘ )

Which of the following is an invalid statement in Python ?

(a) F.seek(1,0) 

(b) F. seek (0, 1)

(c) F . seek (0 ,-1)

(d) F . seek (0 ,2)

[35] Assertion (A): CSV file is a human-readable text file where each line has a number of fields, separated by a comma or some other delimiter.

Reason (R): writerow() method is used to write a single row in a CSV file.

(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.

[36] Asserstion(A): The expression “HELLO” . sort ( ) in Python will give an error.

Reason(R) :  sort ( ) does not exist as a method/function for strings in python.

(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.

[37] State True or False: “Comments are not executed by interpreter.”

[38] Which of the following is not a sequential datatype in Python ?
(a) Dictionary

(b) String

(c) List

(d) Tuple

[39] Given the following dictionary:
Day={1:”Monday”, 2: “Tuesday”, 3: “Wednesday”}
Which statement will return “Tuesday”.
(a) Day.pop()

(b) Day.pop(2)

(c) Day.pop(1)

(d) Day.pop(“Tuesday”)

[40] Consider the given expression :
7<4 or 6>3 and not 10==10 or 17>4
Which of the following will be the correct output if the given expression is evaluated?
(a) True

(b) False

(c) NONE

(d) NULL

[41] Select the correct output of the code :

S="Amrit Mahotsav @ 75"
A=S.split(" ",2)
print(A)

(a) (‘Amrit’, ‘Mahotsav’,’@’,’75’)

(b) [‘Amrit’,’Mahotsav’,’@ 75′]

(c) (‘Amrit’, ‘Mahotsav’,’@75′)

(d) [‘Amrit’,’Mahotsav’,’@’,’75’]

[42] Which of the following modes in Python creates a new file, if the file does not exist and overwrites the content if the file exists?
(a) r+

(b) r

(c) w

(d) a

[43] Fill in the blank : ______________ is not a valid built-in function for list manipulations.
(a) count()

(b) length()

(c) append()

(d) extend()

[44] Which of the following is an example of identity operators of Python ?
(a) is

(b) on

(c) in

(d) not in

[45] Which of the following statement(s) would give an error after executing the following code?

S="Happy"          # Statement 1
print(S*2)         # Statement 2
S+="Independence"  # Statement 3
S.append("Day")    # Statement 4
print(S)           # Statement 5

(a) Statement 2

(b) Statement 3

(c) Statement 4

(d) Statement 3 and 4

[46] Fill Fill in the blank :
In a relational model, tables are called ______________, that store data for different columns.
(a) Attributes

(b) Degrees

(c) Relations

(d) Tuples

[47] The correct syntax of tell() is :
(a) tell.file_object()
(b) file_object.tell()
(c) tell.file_object(1)
(d) file_object.tell(1)

[48] Fill in the blank: _____________ statement of SQL is used to insert new records in a table.
(a) ALTER
(b) UPDATE
(c) INSERT
(d) CREATE

[49] Fill in the blank: In ____________ switching, before communication starts, a dedicated path is identified between the sender and the receiver.
(a) Packet
(b) Graph
(c) Circuit
(d) Plot

[50] What will the following expression be evaluated to in Python ?
print(6/3 + 4**3//8-4)
(a) 6.5
(b) 4.0
(c) 6.0
(d) 4

Watch this video to learn more:

[51] Which of the following functions is a valid built-in function for both list and dictionary datatype?
(a) items()
(b) len()
(c) update()
(d) values()

[52] fetchone() method fetches only one row in a ResultSet and returns a ____________.
(a) Tuple
(b) List
(c) Dictionary
(d) String

[53] Assertion (A) : In Python, a stack can be implemented using a list.
Reasoning (R) : A stack is an ordered linear list of elements that works on the principle of First In First Out (FIFO).

(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.

[54] Assertion (A) : readlines() reads all the lines from a text file and returns the lines along with newline as a list of strings.
Reasoning (R) : readline() can read the entire text file line by line without using any looping statements.

[55] State True or False: Identifiers are names used to identify a variable, or function in a program.

[56] Which of the following is a valid keyword in Python?

(a) false

(b) return

(c) non_local

(d) none

[57] Given the following Tuple:
Tup= (10, 20, 30, 50)
Which of the following statements will result in an error?

(a) print (Tup[0])

(b) Tup.insert (2, 3)

(c) print (Tup [1:2])

(d) print (len (Tup))

[58] Consider the given expression :
5<10 and 12>7 or not 7>4
Which of the following will be the correct output, if the given expression is evaluated?

(a) True

(b) False

(c) NONE

(d) NULL

[59] Select the correct output of the code :

S= "Amrit Mahotsav @ 75"
A=S.partition (" ")
print (A)

(a) (‘Amrit Mahotsav’,’@’,’75’)
(b) [‘Amrit’,’Mahotsav’,’@’,’75’]
(c) (‘Amrit’, ‘Mahotsav @ 75’)
(d) (‘Amrit’,” , ‘Mahotsav @ 75’)

[60] Which of the following mode keeps the file offset position at the end of the file ?
(a) r+

(b) r

(c) w

(d) a

[61] Fill in the blank: ____________ function is used to arrange the elements of a list in ascending order.
(a) sort()

(b) arrange()

(c) ascending()

(d) asort()

[62] Which of the following operators will return either True or False?
(a) +=

(b) !=

(c) =

(d) *=

[63] Which of the following statement(s) would give an error after executing the following code?

Stud={"Murugan" : 100, "Mithu" : 95} # Statement 1
print (Stud[95])                     # Statement 2
Stud ["Murugan"]=99                  # Statement 3
print(Stud.pop())                    # Statement 4
print(Stud)                          # Statement 5

(a) Statement 2

(b) Statement 3

(c) Statement 4

(d) Statements 2 and 4

[64] Fill in the blank: _____________ is a number of tuples in a relation.
(a) Attribute

(b) Degree

(c) Domain

(d) Cardinality

[65] The syntax of seek () is : file_object.seek (offset[, reference_point] )
What is the default value of reference_point?
(a) 0

(b) 1

(c) 2

(d) 3

[66] Fill in the blank : ____________ clause is used with SELECT statement to display data in a sorted form with respect to a specified column.
(a) WHERE

(b) ORDER BY

(c) HAVING

(d) DISTINCT

[67] Fill in the blank : _________ is used for point-to-point communication or unicast communication such as radar and satellite.
(a) INFRARED WAVES

(b) BLUETOOTH

(c) MICROWAVES

(d) RADIOWAVES

[68] What will the following expression be evaluated to in Python?
print(4+3*5/3–5%2)
(a) 8.5

(b) 8.0

(c) 10.2

(d) 10.0

[69] Which function returns the sum of all elements of a list?
(a) count()

(b) sum()

(c) total()

(d) add()

[70] fetchall() method fetches all rows in a result set and returns a :
(a) Tuple of lists

(b) List of tuples

(c) List of strings

(d) Tuple of strings

[71] Assertion (A) : To use a function from a particular module, we need to import the module.
Reason (R) : import statement can be written anywhere in the program, before using a function from that module.

(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.

[72] Assertion (A): A stack is a LIFO structure.
Reason (R) : Any new element pushed into the stack always gets positioned at the index after the last existing element in the stack

(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.

[73] Expand FTP.

[74] Out of the following, which has the largest network coverage area?
LAN, MAN, PAN, WAN

Watch this video to learn more:

2 Marks Questions

[1] (i) Expand the following terms : URL, XML
(ii) Give one difference between HTTP and FTP.

Ans.:

(i)

  • URL: Uniform Resource Locator
  • XML: Extensible Markup Language

(ii)

FeatureHTTP (HyperText Transfer Protocol)FTP (File Transfer Protocol)
PurposeUsed for transferring web pages and resources over the internet.Used for transferring files between a client and a server.
PortUses port 80 (default).Uses ports 20 and 21 (default).

[2] (i) Define the term IP address with respect to network.
(ii) What is the main purpose of a Router?

Ans.:

(i) IP Address: It is the unique address for each computer on a network.

(ii) A router is a device that:

  1. allows multiple devices to use the same Internet connection.
  2. connects two or more packet-switched networks or subnetworks.
  3. manages traffic between networks by forwarding data packets to their intended IP addresses

[3] Observe the following code carefully and rewrite it after removing all syntactical errors. Underline all the corrections made.

def 1func():
  a=input("Enter a number"))
  if a>=33
      print("Promoted to next class")
  ELSE:
      print("Repeat")

Ans.:

def func1(): # Error Correction 1 (or Any other valid correction)
   a=int(input("Enter a number")) # Error Correction 2
   if a>=33: # Error Correction 3
      print("Promoted to next class")
   else: # Error Correction 4
      print("Repeat")

[4] Write the definition of a method/function SearchOut(Teachers,TName) to search for TName from a list Teachers, and display the position of its presence.

For example :
If the Teachers contain [“Ankit”, “Siddharth”, “Rahul”, “Sangeeta”, “rahul”]
and TName contains “Rahul”

The function should display
Rahul at 2
rahul at 4

Ans:

def SearchOut(Teachers, TName):
   for I in range(len(Teachers)):
      if TName.lower() == Teachers[I].lower():
           print(Teachers[I],"at",I)
L=["Ankit", "Siddharth", "Rahul", "Sangeeta", "rahul"]
SearchOut(L,'RAHUL')

OR
def SearchOut(Teachers, TName):
   cnt=0
   for I in Teachers:
      cnt+=1
      if TName.lower() == I.lower():
           print(I,"at",cnt-1)
L=["Ankit", "Siddharth", "Rahul", "Sangeeta", "rahul"]
SearchOut(L,'RAHUL')

(½ Mark for the loop to process individual names in the list Teachers)
(1 Mark for non-case sensitive correct comparison with Tname)
(½ Mark for printing in correct format)

[5] Write the definition of a method/function Copy_Prime(lst) to copy all the prime numbers from the list lst to another list lst_prime.

Ans.:

def Copy_Prime(lst):
lst_prime=[]
for L in lst:
for N in range(2,L//2+1): # OR for N in range(2,L**0.5+1):
if L%N==0:
break
else:
lst_prime.append(L)
return lst_prime

(½ Mark for the loop to select the number from the list lst)
(1 Mark for correctly identifying prime number)
(½ Mark for appending the prime number in the list lst_prime)

[6] Predict the output of the following code :

d={"IND":"DEL","SRI:"COL","CHI":"BEI"}
str1=""
for i in d:
    str1=strl+str(d[i])+"@"
    str2=str1[:–1]
print (str2)

Ans.:

TypoError in dictionary key: "SRI:"COL" has a misplaced colon; it should be "SRI":"COL" and str1 and strl are differently typed.

Let's go through the corrected code step by step for each iteration.
Initial state:
- d = {"IND": "DEL", "SRI": "COL", "CHI": "BEI"}
- str1 = "" (empty string)

Iteration-wise execution:
Iteration 1 (i = "IND")
- d[i] = d["IND"] = "DEL"
- str1 = str1 + d[i] + "@"
- str1 = "" + "DEL" + "@"
- str1 = "DEL@"

Iteration 2 (i = "SRI")
- d[i] = d["SRI"] = "COL"
- str1 = str1 + d[i] + "@"
- str1 = "DEL@" + "COL" + "@"
- str1 = "DEL@COL@"

Iteration 3 (i = "CHI")
- d[i] = d["CHI"] = "BEI"
- str1 = str1 + d[i] + "@"
- str1 = "DEL@COL@" + "BEI" + "@"
- str1 = "DEL@COL@BEI@"

After the loop:
- str1 = "DEL@COL@BEI@"
- str2 = str1[:-1] → removes the last "@"
- str2 = "DEL@COL@BEI"

Final Output:
DEL@COL@BEI

(1 Mark for writing DEL COL BEI)
(1 Mark for correct format and placement of @)
OR
(2 Marks for mentioning error in the given code)

[7] Write the Python statement for each of the following tasks using BUILT-IN functions/methods only :
(i) To delete an element 10 from the list lst.
(ii) To replace the string “This” with “That” in the string str1.

Ans.:

(i) lst.remove(10)

Note:● ½ Mark to be awarded if answer is lst.pop(9) or lst.pop(10)

(ii) str1.replace(“This”,”That”)

(1 Mark for writing correct command using valid BUILT-IN method/function) for (i) and (ii)

[8] A dictionary dict2 is copied into the dictionary dict1 such that the common key’s value gets updated. Write the Python commands to do the task and after that empty the dictionary dict1.

Ans.:

dict1.update(dict2)
dict1.clear()
(1 Mark for correctly updating the dictionary dict1 by dict2)
(1 Mark for correctly emptying the dictionary dict1)

[9] Mr. Atharva is given a task to create a database, Admin. He has to create a table, users in the database with the following columns :
User_id – int
User_name – varchar(20)
Password – varchar(10)
Help him by writing SQL queries for both tasks.

Ans.:

CREATE DATABASE Admin;
CREATE TABLE users
(User_id int,
User_name varchar(20),
Password varchar(10));
(1 Mark for each correct command)

[10] Ms. Rita is a database administrator at a school. She is working on the table, student containing the columns like Stud_id, Name, Class and Stream. She has been asked by the Principal to strike off the record of a student named Rahul with student_id as 100 from the school records and add another student who has been admitted with the following details :
Stud_id – 123
Name – Rajeev
Class – 12
Stream – Science
Help her by writing SQL queries for both tasks.

DELETE FROM Student
WHERE Name="Rahul" and Stud_id=100;

INSERT INTO Student(Stud_id, Name, Class, Stream)
VALUES (123,"Rajeev",12,"Science");

(1 Mark for each correct SQL query)

[11] Predict the output of the following code :

def Total(Num=10):
   Sum=0
   for C in range(1,Num+1):
      if C%2!=0:
        continue
      Sum+=C
   return Sum
print(Total(4),end="$")
print(Total(),sep="@")

Ans.:

Execution:
First Call: Total(4)
Num = 4
Iteration:
C = 1 (odd) → skip
C = 2 (even) → Sum += 2 → Sum = 2
C = 3 (odd) → skip
C = 4 (even) → Sum += 4 → Sum = 6
Return: 6

Second Call: Total() (Default Num=10)
Num = 10
Iteration:
C = 1 (odd) → skip
C = 2 (even) → Sum += 2 → Sum = 2
C = 3 (odd) → skip
C = 4 (even) → Sum += 4 → Sum = 6
C = 5 (odd) → skip
C = 6 (even) → Sum += 6 → Sum = 12
C = 7 (odd) → skip
C = 8 (even) → Sum += 8 → Sum = 20
C = 9 (odd) → skip
C = 10 (even) → Sum += 10 → Sum = 30
Return: 30

Final Output: 6$30

( 1 Mark for each value of correct output)
Note: Deduct ½ mark only if $ not written correctly

[12] (i) Expand the following terms: XML ,PPP
(ii) Give one difference between circuit switching and packet switching.

Ans.:

(i) XML – eXtenisble Markup Language, PPP – Point to Point Protocol

(½ Mark for writing correct expansion of XML)
(½ Mark for writing correct expansion of PPP)

(ii)

Circuit SwitchingPacket Switching
A dedicated path is established between
the sender and the receiver before
starting data transmission. Entire data is
transmitted in one go.
Data to be transmitted is divided into small
packets which are transmitted via nearest
service provider till all packets reach the
recipient where the packets are reassembled.

(½ Mark for writing correct technique for Circuit Switching)
(½ Mark for writing correct technique for Packet Switching)

[13] (i) Define the term web hosting.
(ii) Name any two web browsers.

Ans.:

(i) Web hosting is a service that allows users to put a website or a webpage onto the internet, and make it a part of the World Wide Web.

(1 Mark for writing the correct definition of Web hosting)

(ii) Google Chrome, Microsoft Edge, Safari, Mozilla Firefox, Opera etc.

(1 mark for writing names of any two web browsers)

[14] The code given below accepts five numbers and displays whether they are even or odd:
Observe the following code carefully and rewrite it after removing all syntax and logical errors :
Underline all the corrections made.

def EvenOdd()
  for i in range(5) :
    num=int(input("Enter a number")
    if num/2==0:
       print("Even")
    else:
    print("Odd")
EvenOdd()

Ans.:

def EvenOdd(): # Error 1 Colon missing
   for i in range(5) :
     num=int(input("Enter a number")) # Error 2 Closingbracket
     if num%2==0: # Error 3 The operator
       print("Even")
     else:
       print("Odd") # Error 4 Indentation
EvenOdd()
(½ Mark for each correction made)

[15] Write a user defined function in Python named showGrades(S) which takes the dictionary S as an argument. The dictionary, S contains Name:[Eng,Math,Science] as key:value pairs. The function displays the corresponding grade obtained by the students according to the following grading rules :

 Average of Eng, Math, Science Grade
 >= 90                         A    
 < 90 but >= 60                B     
 < 60                          C    

For example : Consider the following dictionary
S={“AMIT”:[92,86,64],”NAGMA”:[65,42,43],”DAVID”:[92,90,88]}

The output should be :
AMIT – B
NAGMA – C
DAVID – A

Ans.:

def showGrades(S):
   for K, V in S. items():
      if sum(V)/3>=90:
          Grade="A"
      elif sum(V)/3>=60:
          Grade=B"
      else:
          Grade="C"
      print(K,"–",Grade)
S={"AMIT":[92,86,64],"NAGMA":[65,42,43],"DAVID":[92,90,88]}
showGrades(S)

OR

def showGrades(S):
    for K in S:
      Sum=0
      for i in range(3):
         Sum+=S[K][i]
         if Sum/3>=90:
            Grade="A"
         elif Sum/3>=60:
            Grade="B"
         else:
            Grade="C"
         print(K,"–",Grade)
S={"AMIT":[92,86,64],"NAGMA":[65,42,43],"DAVID":[92,90,88]}
showGrades(S)

(½ Mark for the loop to process individual students from the dictionary)
(1 Mark for calculating grades)
(½ Mark for displaying grades)

[16] Write a user defined function in Python named Puzzle(W,N) which takes the argument W as an English word and N as an integer and returns the string where every Nth alphabet of the word W is replaced with an underscore (“_”).

For example : if W contains the word “TELEVISION” and N is 3, then the function should return the string “TE_EV_SI_N”. Likewise for the word “TELEVISION” if N is 4, then the function should return “TEL_VIS_ON”.

Ans.:

Word="TELEVISION"
def Puzzle(W, N):
   NW=""
   Count=1
   for Ch in W:
     if Count!=N:
       NW+=Ch
       Count+=1
     else: 
       NW+="_"
       Count=1
   return NW
print(Puzzle(Word,3))

OR
def Puzzle(W,N):
   W1=""
   for i in range(len(W)):
      if (i+1)%N==0:
        W1=W1+"_"
      else:
        W1=W1+W[i]
   return W1
print(Puzzle("TELEVISION",4))

def Puzzle(W, N):
    words = list(W)
    for i in range(N-1, len(W), N):
        words[i] = "_"
    return "".join(words)
print(Puzzle("TELEVISION", 3))  
print(Puzzle("TELEVISION", 4))  

(½ Mark for the loop to process individual (or Nth) characters)
(1 Mark for changing/replacing the required characters)
(½ Mark for returning the new word)

[17] Write the output displayed on execution of the following Python code :

LS=["HIMALAYA","NILGIRI","ALASKA","ALPS"]
D={}
for S in LS :
      if len(S)%4 == 0:
          D[S] = len(S)
for K in D :
    print(K,D[K], sep = "#")

Ans.:

Define the list LS:
LS = ["HIMALAYA", "NILGIRI", "ALASKA", "ALPS"]

Initialize an empty dictionary D:
D = {}

Iterate through each word in LS and check if its length is divisible by 4:
"HIMALAYA" → Length = 8 (Divisible by 4) → ✅ Add to D
"NILGIRI" → Length = 7 (Not Divisible by 4) → ❌ Skip
"ALASKA" → Length = 6 (Not Divisible by 4) → ❌ Skip
"ALPS" → Length = 4 (Divisible by 4) → ✅ Add to D
Now, D contains:
D = {"HIMALAYA": 8, "ALPS": 4}

Print the dictionary contents:
HIMALAYA#8
ALPS#4

(1 Mark for each line of output)
(Deduct ½ Mark if the entire output is correct but the formatting or line break or
separating characters is/are incorrect)

[18] Write the Python statement for each of the following tasks using built-in functions/methods only :
(i) To remove the item whose key is “NISHA” from a dictionary named Students.
For example, if the dictionary Students contains
{“ANITA”:90, “NISHA”:76, “ASHA”:92}, then after removal the dictionary should contain{“ANITA”:90,”ASHA”:92}
(ii) To display the number of occurrences of the substring “is” in a string named
message.
For example if the string message contains “This is his book”, then the
output will be 3.

Ans.:

(i)
Students.pop("NISHA")
OR
del(Students["NISHA"])
OR
del Students["NISHA"]

(ii)
print(message.count("is"))
OR
message.count("is")

(1 Mark for each correct command)

[19] A tuple named subject stores the names of different subjects. Write the Python commands to convert the given tuple to a list and thereafter delete the last element of the list.

Ans.:

subject=list(subject)
subject.pop()
OR
subject=list(subject)
subject.pop(-1)
OR
subject=list(subject)
del(subject[-1])
OR
subject=list(subject)
del subject[-1]

(1 Mark for correctly converting to list)
(1 Mark for correctly popping the last element/name)

[20] Ms. Veda created a table named Sports in a MySQL database, containing columns Game_id, P_Age and G_name.
After creating the table, she realized that the attribute, Category has to be added. Help her to write a command to add the Category column. Thereafter, write the command to insert the following record in the table :
Game_id : G42
P_Age : Above 18
G_name : Chess
Category : Senior

Ans.:

ALTER TABLE SPORTS
ADD CATEGORY VARCHAR(10);
OR
ALTER TABLE SPORTS
ADD COLUMN CATEGORY VARCHAR(10);
OR
ALTER TABLE SPORTS
ADD CATEGORY CHAR(10);
OR
ALTER TABLE SPORTS
ADD COLUMN CATEGORY CHAR(10);

INSERT INTO SPORTS
VALUES("G42","Above 18","Chess","Senior");
OR
INSERT INTO SPORTS(Game_id, P_Age, G_name, Category)
VALUES("G42","Above 18","Chess","Senior");

(½ Mark for ALTER TABLE command)
(½ Mark for ADD CATEGORY part)
(½ Mark for INSERT INTO command)
(½ Mark for VALUES part )

Watch this video to learn more:

[21] Write the SQL commands to perform the following tasks :
(i) View the list of tables in the database, Exam.
(ii) View the structure of the table, Term1.

Ans.:

(i) SHOW TABLES;
(ii) DESCRIBE Term1
OR
DESC Term1
Note: Ignore USE Exam; if not written
(1 Mark for each correct command)

[22] Predict the output of the following code :

def callon(b=20,a=10) :
  b=b+a
  a=b-a
  print(b, "#" , a )
  return b
x=100
y=200
x=callon(x,y)
print (x,"@", y)
y=callon(y)
print (x,"@",y)

Ans.:

300#100
300@200
210#200
300@210

( ½ Mark for each line of correct output)
(Deduct ½ mark only if all the numeric parts of the output are correct but
formatting or/and separators are incorrect)

[23] Ravi, a Python programmer, is working on a project in which he wants to write a function to count the number of even and odd values in the list. He has written the following code but his code is having errors. Rewrite the correct code and underline the corrections made.

define EOCOUNT(L):
  even_no=odd_no=0
  for i in range(0,len(L))
    if L[i]%2=0:
      even_no+=1
    Else:
      odd_no+=1
print(even_no, odd_no)

Ans.:

def EOCOUNT(L): # Error 1 define word 
   even_no=odd_no=0
      for i in range(0,len(L)): # Error 2 Colon is missing
        if L[i]%2==0: # Error 3 = is required
             even_no+=1
        else: # Error 4 e should be lower
             odd_no+=1
print(even_no, odd_no)
(½ Mark for correctly identifying and correcting each of the four errors)
Note: 1 Mark for identifying all 4 errors without any correction

[24] Write any two differences between Fiber-optic cable and Coaxial cable.

Ans.:

FeatureFiber-Optic CableCoaxial Cable
Transmission MediumUses light signals through glass or plastic fibers.Uses electrical signals through a copper core.
Speed & BandwidthHigher speed and bandwidth, suitable for high-speed internet and long-distance communication.Lower speed and bandwidth, commonly used for cable TV and broadband internet.

(2 Marks for writing the correct difference between Fiber-optic cable and coaxial cable)
OR
(1 Mark for correctly defining Fiber-optic cable)
(1 Mark for correctly defining coaxial cable)

[25] Write one advantage and one disadvantage of wired over wireless communication.

Ans.:
Wired technologies:
Advantage:
● point to point connectivity between nodes and are not affected by the variation in weather conditions.
● Speed is higher in wired connectivity.
Disadvantage:
● Cut in cable (Wired Technology) will result in network failure
Examples
● Optical Fiber, Ethernet Cable, Co-axial Cable are used in Wired Technologies
Wireless technologies:
Disadvantage:
● are not necessarily point to point connectivity between nodes and can be
affected by the variation in weather conditions.
● Speed is lesser as compared to wired connectivity.
Advantage:
● There is no issue of physical cut
Examples
● Bluetooth, Microwave, Radiowave, Satellite Links are examples of Wireless Technologies

(1 Mark for writing any one correct advantage of wired over wireless communication)
(1 Mark for writing any one correct disadvantage of wired over wireless communication)
Note:
1 Mark for only specifying the names of Wired and Wireless Technologies

[26] (a) Given is a Python string declaration : NAME = “Learning Python is Fun”
Write the output of : print(NAME[-5:-10:-1])

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

dict1={1:["Rohit",20], 2:["Siya",90]}
dict2={1:["Rahul",95], 5:["Rajan",80]}
dict1.update(dict2)
print(dict1.values())

Ans.:

(a)

Slicing Syntax: NAME[-5:-10:-1]

Start at index -5 → 's'
Move in steps of -1 (backward) until index -10 (excluding -10)
The characters from -5 to -9 (since -10 is excluded) are:
's' → 'i' → ' ' → 'n' → 'o'
Final Output: 'si no'
(1 Mark for writing the correct output)

(b)

Initial Dictionaries:
dict1 = {1: ["Rohit", 20], 2: ["Siya", 90]}
dict2 = {1: ["Rahul", 95], 5: ["Rajan", 80]}

dict1.update(dict2) Behavior:
The .update() method updates dict1 with dict2.
If a key exists in both dictionaries, dict1's value for that key is replaced with dict2's value.
If a key exists only in dict2, it is added to dict1.
After the update:
dict1 = {
    1: ["Rahul", 95],  # Updated from dict2
    2: ["Siya", 90],   # Remains unchanged
    5: ["Rajan", 80]   # Newly added from dict2
}

print(dict1.values()) Output:
dict1.values() returns a view of all values in dict1:
dict_values([["Rahul", 95], ["Siya", 90], ["Rajan", 80]])

This means:
"Rohit" was replaced by "Rahul" for key 1.
Key 5 with value ["Rajan", 80] was added.
Key 2 remained unchanged.
(1 Mark for writing the correct output)
Note: ignore if dict_values() is not written with the output

[27] Explain the usage of HAVING clause in GROUP BY command in RDBMS with the help of an
example.

Ans.:

HAVING is used for including conditions based on aggregate functions on groups.
SELECT DEPT, COUNT() FROM EMPLOYEE GROUP BY DEPT HAVING COUNT()>1;
Above command will return the number of employees in each department for the departments having more than 1 employee.

(1 Mark for writing any correct example of HAVING)
(1 Mark for writing the correct explanation of the query or the output)
OR
(1 Mark for explaining use of HAVING correctly without example)

[28] (a) Write the full forms of the following :
(i) XML
(ii) HTTPS

(b) What is the use of FTP ?

Ans.:

(a) (i) Extensible Markup Language
(ii) Hyper-Text Transfer Protocol Secure

(b) Protocol is needed to download, upload and transfer files

OR

File Transfer Protocol

(1 Mark for correctly defining OR full form of FTP)

[29] Write the output of the Python code given below :

g=0
def fun1(x,y):
 global g
 g=x+y
 return g
def fun2(m,n):
 global g
 g=m-n
 return g
k=fun1(2,3)
fun2(k,7)
print(g)

Ans.:

Step-by-step Execution:
Global variable g initialized to 0
g = 0

Call fun1(2,3)
g = 2 + 3 = 5
Returns 5, which is stored in k
Call fun2(k,7), which is fun2(5,7)

g = 5 - 7 = -2
Updates global g to -2
Print g
The final value of g is -2, so the output is: -2 
(2 Mark for writing the correct output)
Note:
Give only 1 mark if 2 written without minus sign

[30] Write the output of the Python code given below :

a=15
def update(x):
  global a
  a+=2
  if x%2==0:
    a*=x
  else:
    a//=x
a=a+5
print(a,end="$")
update(5)
print(a)

Ans.:

Step-by-step Execution:
Initial value of a:
a = 15
a = a + 5
a = 15 + 5 = 20
print(a, end="$")
Output: 20$

Calling update(5)
a += 2 → a = 20 + 2 = 22
Since 5 is odd (5 % 2 != 0), execute a //= x:
a = 22 // 5 = 4  (Integer division)
Final print(a)
Output: 4

Final Ouptut:
20$4

(2 Mark for writing the correct output)
Note:
Deduct ½ Mark for not writing $ at correct place
Deduct ½ Mark for writing the output in two lines

[31] Differentiate between IN and BETWEEN operators in SQL with appropriate examples.

Ans.:

FeatureIN OperatorBETWEEN Operator
DefinitionUsed to check if a value exists within a specified set of values.Used to check if a value falls within a specified range.
UsageWorks with a list of discrete values.Works with a continuous range (numeric, date, or text).
Syntaxcolumn_name IN (value1, value2, value3, …)column_name BETWEEN value1 AND value2
ExampleSELECT * FROM Employees WHERE department IN (‘HR’, ‘IT’, ‘Finance’);SELECT * FROM Employees WHERE salary BETWEEN 40000 AND 60000;
Number of ValuesCan check multiple specific values.Works with exactly two boundary values.
Inclusive?No specific range, checks for listed values only.Inclusive of both boundary values (value1 and value2).


(2 Marks for explaining the difference with appropriate example(s))
OR
(1 Mark for correct use of IN in SQL with appropriate example)

[32] Which of the following is NOT a DML command: DELETE, DROP, INSERT, UPDATE

Ans.:

DROP

(2 Marks for mentioning the correct answer)
(Deduct ½ mark for writing each wrong answer, if written along with DROP)

[33] Atharva is a Python programmer working on a program to find and return the maximum value from the list. The code written below has syntactical errors. Rewrite the correct code and underline the corrections made.

def max_num (L) :
   max=L(0)
   for a in L :
     if a > max
     max=a
   return max

Ans.:

def max_num (L) :
    max=L[0]    # Error 1 Brackets
    for a in L:
      if a > max: # Error 2 Color is missing
        max=a     # Error 3 Indentation
return max

(1½ marks for correcting all 3 mistakes)
(½ mark for underlining the corrections)
OR
(1 mark for correcting only 2 mistakes)
(½ mark for underlining the corrections)
OR
(½ mark for correcting only 1 mistake)
(½ mark for underlining the correction)

[34] Differentiate between wired and wireless transmission.

Ans.:

FeatureWired TransmissionWireless Transmission
DefinitionUses physical cables (such as copper wires, fiber optics) to transmit data.Uses electromagnetic waves (such as radio waves, microwaves) for data transmission.
MediumUses cables like twisted pair, coaxial, or fiber-optic cables.Uses signals through air, such as Wi-Fi, Bluetooth, and satellite communication.
Speed & BandwidthGenerally faster with higher bandwidth and stable connections.Usually slower and may have lower bandwidth due to interference.
InterferenceLess prone to interference, providing a stable connection.More prone to interference from other electronic devices, weather, and obstacles.
MobilityLimited mobility as devices are physically connected.High mobility, allowing devices to move freely within range.
SecurityMore secure as data is confined within physical cables.Less secure due to the risk of interception and hacking.

(2 marks for differentiating with or without examples)
OR
(1 mark each for defining each type with or without examples)
OR
(½ mark each for mentioning example of each type)

[35] Differentiate between URL and domain name with the help of an appropriate example.

Ans.:

FeatureURL (Uniform Resource Locator)Domain Name
DefinitionThe complete web address used to access a specific resource on the internet.The human-readable part of a website’s address that identifies a specific website.
ComponentsIncludes protocol, domain name, path, query parameters, etc.Part of the URL, mainly consisting of the website name and extension (TLD).
ScopeRefers to a specific webpage, file, or resource.Refers to the main website address only.
Examplehttps://www.example.com/products/item1.htmlexample.com
HierarchyA complete web address, which includes the domain name.A subset of a URL, representing the website’s main name.

(2 marks for writing any one difference with the help of examples)
OR
(2 marks for writing examples to differentiate correctly)
OR
(1 mark only for writing any one difference without examples)

[36] (a) Given is a Python list declaration :
Listofnames=[“Aman”,”Ankit”,”Ashish”,”Rajan”,”Rajat”]
Write the output of :
print (Listofnames [–1:–4:–1])

(b) Consider the following tuple declaration :
tup1=(10,20,30,(10,20,30),40)
Write the output of :
print(tupl.index(20))

Ans.:

(a) Elements with their indices:

IndexValueNegative Index
0“Aman”-5
1“Ankit”-4
2“Ashish”-3
3“Rajan”-2
4“Rajat”-1
Slicing:
-1: Start from the last element ("Rajat").
-4: Stop before reaching index -4 ("Ankit").
-1: Move in reverse order (step size of -1).

Extracted Elements:
Index -1 → "Rajat"
Index -2 → "Rajan"
Index -3 → "Ashish"

Output: ['Rajat', 'Rajan', 'Ashish']

(1 mark for writing the correct output with/without formatting)
OR
(½ mark for mentioning the correct names -'Ashish', 'Rajan', 'Rajat' but not in correct order)

(b)

Tuple Elements and Their Index Positions:pgsqlCopyEditIndex 0 → 10 Index 1 → 20 Index 2 → 30 Index 3 → (10, 20, 30) (A nested tuple) Index 4 → 40
Using index(20)
The .index(value) method returns the first occurrence of the given value.
20 appears at index 1 in tup1.

Final Output:
1
Key Notes:
Even though (10, 20, 30) (a nested tuple) also contains 20, index() only searches at the top level and stops at the first match.
If you need to find 20 inside the nested tuple, you would need additional logic.

1 mark for correct output

[37] Explain the concept of ‘‘Alternate Key’’ in a Relational Database Management System with an appropriate example.

Ans.:

Alternate Keys are all the Candidate Keys of a RDBMS table, which have not been used as a Primary Key.
Example:

RegNo AadhaarNo Name
 123456 123456789012 Abraham Sen
123458 123456789123 Umeed Singh

In this example, any one of the RegNo and AadhaarNo can be used as a Primary Key. If RegNo is used as the Primary Key then AadhaarNo is the Alternate Key.

(2 mark for explaining Alternate Keys with example)
OR
(1 mark for writing example of Alternate Keys without any explanation)
OR
(1 mark only for writing the definition of Alternate Keys)

[38] (a) Write the full forms of the following:
(i) HTML
(ii) TCP

(b) What is the need of Protocols ?

Ans.:

(a)

(i) HTML : Hyper Text Markup Language
(ii) TCP : Transmission Control Protocol

(½ mark for writing each of the two full forms)

(b)

Protocols are needed for communication between computers.
(1 mark for writing any one need OR definition OR explanation)

[39] Write the output of the code given below :

def short_sub (lst,n) :
  for i in range (0,n) :
    if len (lst)>4:
      lst [i]=lst [i]+lst[i]
    else:
      lst[i]=lst[i] 
subject=['CS','HINDI','PHYSICS','CHEMISTRY','MATHS']
short_sub(subject,5)
print(subject)

Ans.:

Loop Iteration Results:
i = 0 → subject[0] = 'CS' + 'CS' → ['CSCS', 'HINDI', 'PHYSICS', 'CHEMISTRY', 'MATHS']
i = 1 → subject[1] = 'HINDI' + 'HINDI' → ['CSCS', 'HINDIHINDI', 'PHYSICS', 'CHEMISTRY', 'MATHS']
i = 2 → subject[2] = 'PHYSICS' + 'PHYSICS' → ['CSCS', 'HINDIHINDI', 'PHYSICSPHYSICS', 'CHEMISTRY', 'MATHS']
i = 3 → subject[3] = 'CHEMISTRY' + 'CHEMISTRY' → ['CSCS', 'HINDIHINDI', 'PHYSICSPHYSICS', 'CHEMISTRYCHEMISTRY', 'MATHS']
i = 4 → subject[4] = 'MATHS' + 'MATHS' → ['CSCS', 'HINDIHINDI', 'PHYSICSPHYSICS', 'CHEMISTRYCHEMISTRY', 'MATHSMATHS']

Output:
['CSCS', 'HINDIHINDI', 'PHYSICSPHYSICS', 'CHEMISTRYCHEMISTRY', 'MATHSMATHS']

(2 Marks for writing the correct output with or without formatting)

[40] Write the output of the code given below:

a =30
def call (x):
   global a
   if a%2==0:
     x+=a
   else:
     x–=a
   return x
x=20
print(call(35),end="#")
print(call(40),end= "@")

Ans.:

Step-by-Step Execution:
Global variable: a = 30 (which is even).

First function call: call(35)

a % 2 == 0 → True (30 is even)
x += a → 35 + 30 = 65
Returns 65
Prints: 65#
Second function call: call(40)

a % 2 == 0 → True (30 is even)
x += a → 40 + 30 = 70
Returns 70
Prints: 70@

Final output:
65#70@ 
(½ marks each for the four components 65, #, 70, @ with or without formatting)

[41] Differentiate between CHAR and VARCHAR data types in SQL with appropriate example.

Ans.:

FeatureCHARVARCHAR
DefinitionFixed-length character string.Variable-length character string.
Storage AllocationAlways takes the defined space, even if the actual data is shorter.Takes only the required space, saving storage.
PerformanceFaster because of fixed-length storage.Slower compared to CHAR for fixed-size data, as it handles variable-length storage.
PaddingPads extra spaces to match the defined length.Does not add extra spaces, stores only the given string.
UsageSuitable for storing fixed-size data like PIN codes, country codes, etc.Suitable for variable-length data like names, addresses, etc.
ExampleCHAR(10): ‘SQL’ is stored as ‘SQL ‘ (padded with spaces).VARCHAR(10): ‘SQL’ is stored as ‘SQL’ (no extra spaces).

2 Marks for mentioning one difference with the help of examples)
OR
(1 Mark each for writing explanation of each type with example)
OR
(½ Mark for each term for mentioning only purpose without example)

[42] Name any two DDL and any two DML commands.

Ans.:

DDL – CREATE, ALTER, DROP (OR any two valid DDL command)
DML – INSERT, UPDATE, DELETE, SELECT ( OR any two valid DML command)

(½ Mark each for the two DDL commands)
(½ Mark each for the two DML commands)

[43] Differentiate between Push and Pop operations in the context of stacks.

Ans.:

FeaturePushPop
FunctionAdds an element to the stackRemoves the top element from the stack
Stack GrowthIncreases sizeDecreases size
Error ConditionStack Overflow (if full)Stack Underflow (if empty)

(1 mark each for writing correct definition/example/explanation of Push and Pop operations)

[44] (a) Expand FTP.

(b) Out of the following, which has the largest network coverage area?
LAN, MAN, PAN, WAN

Ans.:

(a) File Transfer Protocol

(1 mark for writing correct expansion)

(b) Largest cover: WAN

(1 mark for writing correct type of network)

[45] Differentiate between Degree and Cardinality in the context of Relational Data Model.

Ans.:

FeatureDegreeCardinality
DefinitionNumber of attributes (columns) in a relationNumber of tuples (rows) in a relation
RepresentsStructure of the tableSize of the table
Changes WhenMore or fewer attributes are added/removedMore or fewer records are inserted/deleted
Example      A table with 4 attributes → Degree = 4A table with 100 rows → Cardinality = 100

(2 marks for writing any valid difference)
OR
(1 mark each for writing correct definition/example/explanation of Degree and Cardinality)

[46] Consider the following table EMPLOYEE in a Database COMPANY :

Table: Employee

E_IDNAMEDEPT
H1001AvneetAC
A1002RakeshHR
A1003AminaAC
H1002SimonHR
A1004PratikAC

Assume that the required library for establishing the connection between Python and MySQL has already been imported into the given Python code.
Also assume that DB is the name of the database connection for the given table EMPLOYEE stored in the database COMPANY.
Predict the output of the following Python code :

CUR = DB.cursor()
CUR.execute("USE COMPANY")
CUR.execute("SELECT * FROM EMPLOYEE WHERE DEPT = 'AC' ")
for i in range(2) :
    R=CUR.fetchone()
    print(R[0], R[1], sep ="#")

Ans.:

Fetching Data:

for i in range(2): → The loop runs twice (fetching two rows).
R = CUR.fetchone() → Retrieves one row at a time from the result set.
print(R[0], R[1], sep ="#") → Prints the first (E_ID) and second (NAME) column values, separated by #.

Query Execution Result (DEPT = 'AC'):
The SELECT query filters rows where DEPT = 'AC'. The relevant rows are:
E_IDNAMEDEPT
H1001AvneetAC
A1003AminaAC
A1004PratikAC
Loop Execution (for i in range(2))
First Iteration (i=0): fetchone() returns the first row → H1001, Avneet
Second Iteration (i=1): fetchone() returns the second row → A1003, Amina
The output will be:
H1001#Avneet
A1003#Amina
(1 mark for writing each correct line of output)
(Note: Deduct ½ mark, if line break or/and # sign is not correctly written)

[47] Write the output of the SQL queries (a) to (d) based on the table TRAVEL given below :
Table: TRAVEL

Important PYQs Computer Science Class 12

(a) SELECT START, END FROM TRAVEL WHERE FARE <=4000;

(b) SELECT T_ID, FARE FROM TRAVEL WHERE T_DATE LIKE ‘2021-12-%’ ;

(c) SELECT T_ID, T_DATE FROM TRAVEL WHERE END = ‘CHENNAI’ ORDER BY FARE ;

(d) SELECT START, MIN(FARE)FROM TRAVEL GROUP BY START ;

Ans.:

(a) 
START       END
---------- -------------
DELHI      BENGLURU

(b)
T_ID        FARE
--------  ------------------
101        4500

(c) 
T_ID    T_DATE
-----   ------------------
101     2021-12-25
103     2020-12-10

(d) 
START         MIN(FARE)
-----------   ------------------
DELHI                    4000
MUMBAI                   5000

(½ mark for writing correct output - with or without column headings)

[48] Write the output of the SQL queries (a) and (b) based on the following two tables FLIGHT and PASSENGER belonging to the same database :

TABLE - FLIGHT AND PASSENGER PYQS COMPUTER SCIENCE CLASS 12

(a) SELECT NAME,DEPART FROM FLIGHT NATURAL JOIN PASSENGER ;

(b) SELECT NAME, FARE FROM PASSENGER P, FLIGHT F WHERE F.FNO = P.FNO AND F.DEPART = ‘MUMBAI’ ;

Ans.:

(a) 
NAME           DEPART
PRAKASH        DELHI
NOOR           MUMBAI
ANNIE          MUMBAI

(b)
NAME         FARE
----------  --------------
NOOR                 5500
ANNIE                5000
(1 mark for writing correct output - with or without column headings)

[49] Explain Primary Key in the context of Relational Database Model. Support your answer with suitable example.

Ans.:

An attribute or a group of attributes that identifies a tuple uniquely is known as a Primary Key of the table.
Example:
Table: STUDENTS

ROLLNONAMECONTACT
1201AVANI9898989898
1202KRISHA9797979797
1203PUJA9494949494
1204KALPESH87878787878

Primary key – ROLLNO

(1 mark for writing only the correct explanation/example of primary key)
(1 mark for writing appropriate example)

[50] Consider the following table BATSMEN :
Table: BATSMEN

PNOPNAMESCORE
P1RISHABH52
P2HUSSAIN45
P3ARNOLD23
P4ARNAV18
P5GURSHARAN52

(a) Identify and write the name of the Candidate Keys in the given table BATSMEN.

(b) How many tuples are there in the given table BATSMEN?

Ans.:

(a) PNO, NAME
(½ mark each for writing correct candidate keys)
(b) 5
(1 mark for writing correct answer)

[51] “Stack is a linear data structure which follows a particular order in which the operations are performed.”
What is the order in which the operations are performed in a Stack? Name the List method/function available in Python which is used to remove the last element from a list implemented stack.
Also write an example using Python statements for removing the last element of the list.

Ans.:

Order of operations performed in a Stack is LIFO (Last In First Out)

The List method in Python to remove the last element from a list implemented stack is pop() OR pop(-1) OR pop

Example:
L=[10,20,30,40]
L.pop() OR L.pop(-1)

(1 mark for writing correct order)
(½ mark for writing pop or any other correct method/function)
(½ mark for writing correct Python code of an example)
OR
(1 mark for writing correct order)
(1 mark for correct Python statement to demonstrate the pop() function)
(Note: FILO - First In Last Out, may also be considered)

[52] (i) Expand the following : VoIP, PPP

(ii) Riya wants to transfer pictures from her mobile phone to her laptop. She uses Bluetooth technology to connect two devices. Which type of network (PAN/LAN/MAN/WAN) will be formed in this case?

Ans.:

VoIP : Voice over Internet Protocol
PPP : Point to Point Protocol

(½ mark each for writing correct expansion)

PAN/ Personal Area Network
(1 mark for correct type of network)

[53] Differentiate between the terms Attribute and Domain in the context of Relational Data Model.

Ans.:

FeatureAttributeDomain
DefinitionA column in a table representing a characteristic of an entity.A set of permissible values for an attribute.
RoleStores actual data for entities in the table.Defines constraints and valid values for attributes.
Example“Age” in the Student table.Integer values between 18 and 30.

(1 mark each for writing any correct explanation of Attribute and Domain)

[54] Consider the following SQL table MEMBER in a SQL Database CLUB:
Table: MEMBER

M_IDNAMEACTIVITY
M1001AminaGYM
M1002PratikGYM
M1003SimonSWIMMING
M1004RakeshGYM
M1005AvneetSWIMMING

Assume that the required library for establishing the connection between Python and MYSQL is already imported in the given Python code. Also assume that DB is the name of the database connection for table MEMBER stored in the database CLUB.
Predict the output of the following code:

MYCUR = DB.cursor()
MYCUR.execute("USE CLUB")
MYCUR.execute("SELECT * FROM MEMBER WHERE ACTIVITY='GYM'")
R=MYCUR.fetchone()
for i in range(2):
   R=MYCUR.fetchone()
   print(R[0], R[1], sep ="#")

Ans.:

 The query retrieves all rows where ACTIVITY = 'GYM', so the result set will be:
M_IDNAMEACTIVITY
M1001AminaGYM
M1002PratikGYM
M1004RakeshGYM
First iteration (i=0):
MYCUR.fetchone() retrieves the next row:
R = ('M1002', 'Pratik', 'GYM')
print(R[0], R[1], sep ="#") 
outputs:
M1002#Pratik

Second iteration (i=1):
MYCUR.fetchone() retrieves the next row:
R = ('M1004', 'Rakesh', 'GYM')
print(R[0], R[1], sep ="#") 
outputs:
M1004#Rakesh

Final Output:
M1002#Pratik
M1004#Rakesh

(1 mark for writing each correct line of output)
(Note: Deduct ½ mark for missing # or writing the output in a single line OR
writing any additional line along with the correct output)

[55] Write the output of the SQL queries (a) to (d) based on the table VACCINATION_DATA given below:
TABLE: VACCINATION_DATA

VIDNameAgeDose1Dose2City
101Jenny272021-12-252022-01-31Delhi
102Harjot552021-07-142021-10-14Mumbai
103Srikanth432021-04-182021-07–20Delhi
104Gazala752021-07-31NULLKolkata
105Shiksha322022-01-01NULLMumbai

(a) SELECT Name, Age FROM VACCINATION_DATA WHERE Dose2 IS NOT NULL AND Age > 40;

(b) SELECT City, COUNT(*) FROM VACCINATION_DATA GROUP BY City;

(c) SELECT DISTINCT City FROM VACCINATION_DATA;

(d) SELECT MAX(Dose1),MIN(Dose2)FROM VACCINATION_DATA;

Ans.:

(a)
Name                 Age
--------------     ----------------
Harjot               55
Srikanth             43

(b)
City                Count(*)
---------------   -------------------
Delhi                             2
Mumbai                            2

(c) 
City
---------------
Delhi
Mumbai
Kolkata

(d) 
MAX(Dose1)                MIN(Dose2)
---------------          ---------------------
2022-01-01                 2021-07-20

(½ mark for each correct output )
(Note: Ignore column heading of the output and order of the output rows)

[56] Write the output of SQL queries (a) and (b) based on the following two tables DOCTOR and PATIENT belonging to the same database :

Table: DOCTOR

DNODNAMEFEES
D1AMITABH1500
D2ANIKET1000
D3NIKHIL1500
D4ANJANA1500

Table:PATIENT

PNOPNAMEADMDATEDNO
P1NOOR2021-12-25D1
P2ANNIE2021-11-20D2
P3PRAKASH2020-12-10NULL
P4HARMEET2019-12-20D1

(a) SELECT DNAME, PNAME FROM DOCTOR NATURAL JOIN PATIENT ;

(b) SELECT PNAME, ADMDATE, FEES FROM PATIENT P, DOCTOR D WHERE D.DNO = P.DNO AND FEES > 1000;

Ans.:

(a) 
DNAME                PNAME
----------------     ---------------------
AMITABH              NOOR
ANIKET               ANNIE
AMITABH              HARMEET
(1 mark for writing correct output)
Note:
Deduct ½ mark for any additional row along with the correct rows
Ignore column heading of the output and order of the output rows

(b) 
PNAME             ADMDATE            FEES
------------     -------------      -----------------
NOOR             2021-12-25                      1500
HARMEET          2019-12-20                      1500
(1 mark for writing correct output)
Note:
Deduct ½ mark for any additional row along with the correct rows
Ignore column heading of the output and order of the output rows

[57] Differentiate between Candidate Key and Primary Key in the context of Relational Database Model.

Ans:

FeatureCandidate KeyPrimary Key
DefinitionA set of one or more attributes that can uniquely identify a record in a table.A specific Candidate Key chosen by the database designer to uniquely identify records in a table.
UniquenessEach Candidate Key must have unique values across all rows.The Primary Key must also be unique across all rows.
Null ValuesCandidate Keys may allow NULL values (unless chosen as the Primary Key).Primary Key cannot have NULL values.
Count in a TableA table can have multiple Candidate Keys.A table can have only one Primary Key.
SelectionNot all Candidate Keys become the Primary Key; only one is selected.It is the chosen Candidate Key for uniquely identifying records.
ExampleIn a Student table: {StudentID, Email} can be Candidate Keys.If StudentID is chosen as the Primary Key, Email remains a Candidate Key.

Example Table: Student

StudentIDNameEmailPhone
101Alicealice@email.com9876543210
102Bobbob@email.com8765432109
  • Candidate Keys: {StudentID, Email}
  • Primary Key (chosen): StudentID
  • Email remains a Candidate Key, but it is not the Primary Key.

(2 marks for correct explanation OR example given to differentiate the keys)
OR
(1 mark for writing only the correct explanation/example of candidate key)
(1 mark for writing only the correct explanation/example of primary key)

[58] Consider the following table PLAYER :
Table: PLAYER

PNONAMESCORE
P1RISHABH52
P2HUSSAIN45
P3ARNOLD23
P4ARNAV18
P5GURSHARAN42

(a) Identify and write the name of the most appropriate column from the given table PLAYER that can be used as a Primary key.

(b) Define the term Degree in relational data model. What is the Degree of the given table PLAYER?

Ans.:

(a) PNO
(1 mark for mentioning PNO)
(Note: Don’t deduct marks, if any additional column name is also mentioned
along with PNO)

(b) Total number of columns/attributes in a table/relation
is known as its Degree.
The Degree of the given table is 3.
(½ mark for writing/explaining with example the correct meaning of Degree)
(½ mark writing correct Degree of the given table)

3 Marks Questions

[1] Predict the output of the Python code given below :

s="India Growing"
n = len(s)
m=""
for i in range (0, n) :
  if (s[i] >= 'a' and s[i] <= 'm') : 
      m = m + s [i].upper() 
  elif (s[i] >= 'O' and    s[i] <= 'z') :
      m = m +s [i-1]
  elif (s[i].isupper()):
    m = m + s[i].lower()
  else:
    m = m + '@'
print (m)

Ans.:

Step-by-Step Execution:
Initialization:
s = "India Growing"
n = len(s) = 13
m = "" (empty string initially)
Iterate through each character:
is[i]Condition Checkm Update
0‘I’isupper() → ✅‘i’
1‘n’‘a’ <= ‘n’ <= ‘m’ → ❌No change
‘O’ <= ‘n’ <= ‘z’ → ❌No change
Else → ✅‘i@’
2‘d’‘a’ <= ‘d’ <= ‘m’ → ✅‘i@D’
3‘i’‘a’ <= ‘i’ <= ‘m’ → ✅‘i@DI’
4‘a’‘a’ <= ‘a’ <= ‘m’ → ✅‘i@DIA’
5‘ ‘None of the conditions match → ✅‘i@DIA@’
6‘G’isupper() → ✅‘i@DIA@g’
7‘r’‘O’ <= ‘r’ <= ‘z’ → ✅‘i@DIA@gG’
8‘o’‘O’ <= ‘o’ <= ‘z’ → ❌No change
‘a’ <= ‘o’ <= ‘m’ → ❌No change
Else → ✅‘i@DIA@gG@’
9‘w’‘O’ <= ‘w’ <= ‘z’ → ✅‘i@DIA@gG@o’
10‘i’‘a’ <= ‘i’ <= ‘m’ → ✅‘i@DIA@gG@oI’
11‘n’‘a’ <= ‘n’ <= ‘m’ → ❌Else → ✅
‘i@DIA@gG@oI@’
12‘g’‘a’ <= ‘g’ <= ‘m’ → ✅‘i@DIA@gG@oI@G’
Final Output: i@DIA@gG@oI@G
(1 Mark for correctly writing the part iIDIA or i@DIA)
(1 Mark for correctly placing the character @ at the 5th position )
(1 Mark for correctly writing the part gGroIiG or gGroI@G)
Note:
Deduct only ½ if the output content is correct but written in different lines or
format is incorrect

[2] Consider the table Stationery given below and write the output of the SQL queries that follow.
Table : Stationery

 ITEMNO ITEM                DISTRIBUTOR    QTY PRICE
 401    Ball Pen 0.5        Reliable Stationers 100 16   
 402    Gel Pen Premium     Classic Plastics     150 20   
 403    Eraser Big          Clear Deals          210 10   
 404    Eraser Small        Clear Deals          200 5    
 405    Sharpener Classic   Classic Plastics     150 8    
 406    Gel Pen Classic     Classic Plastics     100 15   

(i) SELECT DISTRIBUTOR, SUM(QTY) FROM STATIONERY GROUP BY DISTRIBUTOR;
(ii) SELECT ITEMNO, ITEM FROM STATIONERY WHERE DISTRIBUTOR = “Classic Plastics” AND PRICE > 10;
(iii) SELCET ITEM, QTY * PRICE AS “AMOUNT” FROM STATIONERY WHERE ITEMNO = 402;

Ans.:

(i) 
DISTRIBUTOR              SUM(QTY)
-------------           ----------
Reliable Stationers            100
Classic Plastics               400
Clear Deals                    410

(ii) 
ITEMNO          ITEM
----------    -----------
       402    Gel Pen Premium
       406    Gel Pen Classic

(iii) 
ITEM                  AMOUNT
----------------  ---------------
Gel Pen Premium              3000

(1 Mark for writing each correct output)
Note:
● Ignore output heading for part (i) and (ii), however, in part (iii),
mentioning AMOUNT as heading of the second column is a must.
● Ignore order of rows
● (for Part iii only): Full 1 Mark for identifying Syntax error for wrongly spelt SELECT as SELCET

[3] Write a method/function COUNTWORDS() in Python to read contents from a text file DECODE.TXT, to count and return the occurrence of those words, which are having 5 or more characters.

Ans.:

def COUNTWORDS():
  NW=0
  with open("DECODE.TXT",'r') as F:
      S=F.read().split()
      for W in S:
        if len(W)>=5:
           NW+=1
  return NW

( ½ Mark for correctly opening the text file in read mode using any valid
method)
( 1 Mark for processing each word in the text file)
( 1 Mark for counting words having 5 or more characters)
( ½ Mark for returning the desired value)

[4] Write a method/function COUNTLINES() in Python to read lines from a text file CONTENT.TXT, and display those lines, which have @ anywhere in the line.

For example :
If the content of the file is :
Had an amazing time at the concert last night with @MusicLoversCrew.
Excited to announce the launch of our new website!
G20 @ India

The method/function should display:
Had an amazing time at the concert last night with @MusicLoversCrew
G20 @ India

Ans.:

def COUNTLINES():
   f=open("CONTENT.TXT","r")
   LS=f.readlines()
   for L in LS:
      if "@" in L:
        print(L)
   f.close()

( ½ Mark for correctly opening the text file in read mode using any valid
method)
( 1 Mark for processing each line in the text file)
( 1 Mark for checking whether a line contains the character @ or not)
( ½ Mark for displaying the desired line)

[5] Consider the table Rent_cab, given below :
Table : Rent_cab

 Vcode VName       Make      Color  Charges
 101   Big car    Carus     White  15     
 102   Small car  Polestar  Silver 10     
 103   Family car Windspeed Black  20     
 104   Classic    Studio    White  30     
 105   Luxury     Trona     Red    9      

Based on the given table, write SQL queries for the following :
(i) Add a primary key to a column name Vcode.
(ii) Increase the charges of all the cabs by 10%.
(iii) Delete all the cabs whose maker name is “Carus”.

Ans.:

(i) ALTER TABLE Rent_cab ADD PRIMARY KEY (Vcode);
(½ Mark for ALTER TABLE part)
(½ Mark for ADD PRIMARY KEY part)

(ii) UPDATE Rent_cab SET Charges=Charges+Charges*10/100
(½ Mark for UPDATE part)
(½ Mark for SET part)

(iii) DELETE FROM Rent_cab WHERE Make="Carus";
(½ Mark for DELETE command)
(½ Mark for WHERE clause)

[6] A dictionary, d_city contains the records in the following format : {state:city}
Define the following functions with the given specifications :
(i) push_city(d_city): It takes the dictionary as an argument and pushes all the cities in the stack CITY whose states are of more than 4 characters.
(ii) pop_city(): This function pops the cities and displays “Stack empty” when there are no more cities in the stack.

Ans.:

(i) 
CITY=[]
def push_city(d_city):
   for c in d_city:
      if len(c) > 4:
         CITY.append(d_city[c])

(ii)
def pop_city():
   while CITY:
      print(CITY.pop())
   else:
      print("Stack empty")

(½ Mark for the correct loop in the function push_city)
( ½ Mark for correctly checking the number of chars in the function push_city)
( ½ Mark for pushing the correct cities into CITY in the function push_city)
( ½ Mark for the correct loop in the function pop_city)
( ½ Mark for correctly checking the underflow condition and printing "Stack
Empty" in the function pop_city)
( ½ Mark for correctly popping in the function pop_city)
Note: Ignore the declaration of CITY

[7] Write the output on execution of the following Python code:

S="Racecar Car Radar"
L=S.split()
for W in L :
   x=W.upper()
   if x==x[::-1]:
     for I in x:
       print(I,end="*")
   else:
       for I in W:
          print(I,end="#")
   print()

Ans.:

Step-by-Step Execution:
L = ['Racecar', 'Car', 'Radar']
Iterating through each word:
First word: "Racecar"
x = "RACECAR"
Check if "RACECAR" == "RACECAR"[::-1] (which is "RACECAR") → True
It enters the first loop - R*A*C*E*C*A*R*

Second word: "Car"
x = "CAR"
Check if "CAR" == "CAR"[::-1] (which is "RAC") → False
It enters the else loop: C#a#r#

Third word: "Radar"
x = "RADAR"
Check if "RADAR" == "RADAR"[::-1] (which is "RADAR") → True
It enters the first loop: R*A*D*A*R*
Final Output:
R*A*C*E*C*A*R*
C#a#r#
R*A*D*A*R*

(1 Mark for each line of correct output)
Note:
● Deduct ½ mark only if all the alphabets are correct but some cases - lower/upper are incorrectly written
● Deduct ½ mark only if all the alphabets are correct but separators - */#
are incorrectly written OR new line not considered

[8] Consider the table ORDERS given below and write the output of the SQL queries that follow:

ORDNOITEMQTYRATEORDATE
1001RICE231202023-09-10
1002PULSES131202023-10-18
1003RICE251102023-11-17
1004WHEAT28652023-12-25
1005PULSES161102024-01-15
1006WHEAT27552024-04-15
1007WHEAT25602024-04-30

(i) SELECT ITEM, SUM(QTY) FROM ORDERS GROUP BY ITEM;
(ii) SELECT ITEM, QTY FROM ORDERS WHERE ORDATE BETWEEN ‘2023-11-01’ AND ‘2023-12-31’;
(iii) SELECT ORDNO, ORDATE FROM ORDERS WHERE ITEM = ‘WHEAT’ AND RATE>=60 ;

Ans.:

(i) 
ITEM             SUM(QTY)
------------    ---------------
RICE                        48
PULSES                      29
WHEAT                       80

(ii) 
ITEM           QTY
---------    ----------
RICE                25
WHEAT               28

(iii) 
ORDNO          ORDATE
----------    ---------------
1004          2023-12-25
1007          2024-04-30

(1 Mark for writing each correct output)
Note:
● Ignore output heading
● Ignore order of rows

[9] Write a user defined function in Python named showInLines() which reads contents of a text file named STORY.TXT and displays every sentence in a separate line. Assume that a sentence ends with a full stop (.), a question mark (?), or an exclamation mark (!).

For example, if the content of file STORY.TXT is as follows :
Our parents told us that we must eat vegetables to be healthy.And it turns out, our parents were right! So, what else did our parents tell?

Then the function should display the file’s content as follows :
Our parents told us that we must eat vegetables to be healthy.
And it turns out, our parents were right!
So, what else did our parents tell?

Ans.:

def showInLines():
  with open("STORY.TXT",'r') as F:
   S=F.read()
   for W in S:
     if W=="." or W=="?" or W=="!":
         print(W)
     elif W=="\n":
         print(end="")
     else: 
         print(W,end="")
  F.close()

OR

def showInLines():
  F = open("STORY.TXT",'r')
    S=F.read()
    for W in S:
      if W.endswith(".") or W.endswith("?") or W.endswith("!"):
         print(W)
      elif W=="\n":
         print(end="")
      else:
         print(W,end="")
 F.close()

OR

def showInLines():
    try:
        with open("STORY.TXT", "r") as file:
            content = file.read()
        
        sentences = []
        sentence = ""
        
        for char in content:
            sentence += char
            if char in ".!?":  
                sentences.append(sentence.strip())  
                sentence = ""  
                
        for sent in sentences:
            print(sent)

    except FileNotFoundError:
        print("File STORY.TXT not found.")

showInLines()

( ½ Mark for correctly opening the file)
( ½ Mark for reading the content of file using any correct method/mode)
( ½ Mark for the correct loop)
( ½ Mark for correctly checking end of sentence terminating characters)
( ½ Mark for correctly printing normal text without sentence terminator)
( ½ Mark for correctly printing text with sentence terminator)

[10] Write a function, c_words() in Python that separately counts and displays the number of uppercase and lowercase alphabets in a text file, Words.txt.

Ans.:

def c_words():
  f=open("Words.txt","r")
  Txt=f.read()
  CLower=CUpper=0
  for i in Txt:
    if i.islower():
      CLower+=1
    elif i.isupper():
      CUpper+=1
  print(CLower, CUpper)
  f.close()

OR
def c_words():
  with open("Words.txt","r") as F:
    Txt=f.read()
    CL=CU=0
    for i in Txt:
      if i.islower(): # if i>="a" and i<="z":
        CL+=1
      elif i.isupper():# if i>="A" and i<="Z":
        CU+=1
  print(CL, CU)

( ½ Mark for correctly opening the file)
( ½ Mark for reading the content of file using any correct method/mode)
( ½ Mark for the correct loop)
( ½ Mark for correctly checking and incrementing for uppercase alphabets)
( ½ Mark for correctly checking and incrementing for lowercase alphabets)
( ½ Mark for printing/returning required output)

[11] Consider the table Projects given below:
Table: Projects

P_id Pname Language Startdate Enddate
P001School Management System Python 2023-01-12 2023-04-03
P002Hotel Management System C++ 2022-12-01   2023-02-02
P003Blood Bank Python 2023-02-11 2023-03-02
P004Payroll Management System Python 2023-03-12 2023-06-02

Based on the given table, write SQL queries for the following:
(i) Add the constraint, primary key to column P_id in the existing table Projects.
(ii) To change the language to Python of the project whose id is P002.
(iii) To delete the table Projects from MySQL database along with its data.

(i) ALTER TABLE Projects ADD PRIMARY KEY (P_id);
(½ Mark for ALTER TABLE part)
(½ Mark for ADD PRIMARY KEY part)

(ii) UPDATE Projects SET LANGUAGE= "Python" WHERE P_id = "P002";
(½ Mark for UPDATE - SET part)
(½ Mark for WHERE part)

(iii) DROP TABLE Projects;
(1 Mark for correct command)
OR
(½ Mark for partial answer such as DROP Projects or DROP TABLE)

[12] Consider a list named Nums which contains random integers. Write the following user defined functions in Python and perform the specified operations on a stack named BigNums.
(i) PushBig(): It checks every number from the list Nums and pushes all such numbers which have 5 or more digits into the stack, BigNums.
(ii) PopBig(): It pops the numbers from the stack, BigNums and displays them. The function should also display “Stack Empty” when there are no more numbers left in the stack.
For example: If the list Nums contains the following data:
Nums = [213, 10025, 167, 254923, 14, 1297653, 31498, 386, 92765]
Then on execution of PushBig(), the stack BigNums should store:
[10025, 254923, 1297653, 31498, 92765]
And on execution of PopBig(), the following output should be displayed:
92765
31498
1297653
254923
10025
Stack Empty

Ans.:

def PushBig(Nums,BigNums):
  for N in Nums:
    if len(str(N)) >= 5:
      BigNums.append(N)

def PopBig(BigNums):
  while BigNums:
    print(BigNums.pop())
  else:
    print("Stack Empty")

OR

def PushBig():
  for N in Nums:
    if N >= 10000:
      BigNums.append(N)

def PopBig():
  while BigNums:
    print(BigNums.pop())
  print("Stack Empty")

( ½ Mark for the correct loop in the function PushBig)
( ½ Mark for correctly checking the number of digits in the function PushBig)
( ½ Mark for pushing the correct number into BigNums in the function PushBig)
( ½ Mark for the correct loop in the function PopBig)
( ½ Mark for correctly checking the underflow condition and printing "Stack
Empty" in the function PopBig)
( ½ Mark for popping and printing the correct number in the function PopBig)
Note:
Ignore the declarations of Nums and/or BigNums

[13] (a) Consider the following tables – Student and Sport :
Table : Student

ADMNONAMECLASS
1100MEENAX
1101VANIXI

Table: Sport

ADMNOGAME
1100CRICKET
1103FOOTBALL

What will be the output of the following statement ?
SELECT * FROM Student, Sport;

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

GCODETYPEPRICEFCODEODR_DATE
G101EVENING GOWN850F032008-12-19
G102SLACKS750F022020-10-20
G103FROCK1000F012021-09-09
G104TULIP SKIRT1550F012021-08-10
G105BABY TOP1500F022020-03-31
G106FORMAL PANT1250F012019-01-06

(i) SELECT DISTINCT(COUNT(FCODE))FROM GARMENT;

(ii) SELECT FCODE, COUNT(), MIN(PRICE) FROM GARMENT GROUP BY FCODE HAVING COUNT()>1;

(iii) SELECT TYPE FROM GARMENT WHERE ODR_DATE >’2021-02-01′ AND PRICE <1500;

(iv) SELECT * FROM GARMENT WHERE TYPE LIKE ‘F%’;

Ans.:

(a) 
ADMNO      NAME       CLASS            ADMNO            GAME
--------  ---------   -----------    ---------------   -----------------
1100      MEENA        X                       1100    CRICKET
1101      VANI         XI                      1100    CRICKET
1100      MEENA        X                       1103    FOOTBALL
1101      VANI         XI                      1103    FOOTBALL

(1 Mark for writing the correct output)
Note:
(Ignore the order of rows and columns of the output)

(b) 
(i) DISTINCT(COUNT(FCODE))
----------------------
                     3
(ii) FCODE     COUNT(*)        MIN(PRICE)
    ---------  -------------- ---------------
    F02                     2             750
    F01                     3            1000
(iii) TYPE
     ----------
      FROCK
(iv) GCODE      TYPE           PRICE       FCODE        ODR_DATE
     ---------  -------       ---------   --------   --------------
     G103       FROCK              1000    F01        2021-09-09
     G106       FORMAL PANT        1250    F01        2019-01-06
(½ Mark for writing correct output)

[14] Write a function in Python that displays the book names having ‘Y’ or ‘y’ in their name from a text file “Bookname.txt”.
Example :
If the file “Bookname.txt” contains the names of following books :
One Hundred Years of Solitude
The Diary of a Young Girl
On the Road
After execution, the output will be :
One Hundred Years of Solitude
The Diary of a Young Girl

Ans.:

def Book_Name():
  fin=open('Bookname.txt')
  lines=fin.readlines()
  for line in lines:
    if 'y' in line or 'Y' in line: # or if 'Y' in line.upper():
      print(line,end="") # ignore end=""
  fin.close()

OR
def Book_Name():
   fin=open('Bookname.txt')
   for line in fin:
      if 'y' in line or 'Y' in line: # or if 'Y' in line.upper():
         print(line,end="") # ignore end=""
   fin.close()

(½ Mark for writing the function header correctly with any function identifier
and/or argument)
(½ Mark for opening the file correctly)
(½ Mark for reading/extracting the lines from the file)
(½ Mark for processing the lines one by one using a loop)
(½ Mark for checking condition for presence of ‘y’ or ‘Y’)
(½ Mark for printing the matching lines)

[15] Write the output of any three SQL queries (i) to (iv) based on the tables COMPANY and CUSTOMER given below :
Table : COMPANY

CIDC_NAMECITYPRODUCTNAME
111SONYDELHITV
222NOKIAMUMBAIMOBILE
333ONIDADELHITV
444SONYMUMBAIMOBILE
555BLACKBERRYCHENNAIMOBILE
666DELLDELHILAPTOP

Table: CUSTOMER

CUSTIDCIDNAMEPRICEQTY
C01222ROHIT SHARMA7000020
C02666DEEPIKA KUMARI5000010
C03111MOHAN KUMAR300005
C04555RADHA MOHAN3000011

(i) SELECT PRODUCTNAME, COUNT()FROM COMPANY GROUP BY PRODUCTNAME HAVING COUNT()> 2;

(ii) SELECT NAME, PRICE, PRODUCTNAME FROM COMPANY C, CUSTOMER CT WHERE C.CID = CU.CID AND C_NAME = ‘SONY’;

(iii) SELECT DISTINCT CITY FROM COMPANY;

(iv) SELECT * FROM COMPANY WHERE C_NAME LIKE ‘%ON%’;

Ans.:

(i)
PRODUCTNAME    COUNT(*)
-------------  ----------
MOBILE                  3
(ii) 
NAME           PRICE        PRODUCTNAME
----------     -----------  ------------------
MOHAN KUMAR          30000   TV
(1 Mark for mentioning ERROR)
(iii) 
DISTINCT(CITY)
----------------
DELHI
MUMBAI
CHENNAI
(iv)
CID     C_NAME      CITY      PRODUCTNAME
------  ----------  --------  -------------
111      SONY        DELHI     TV
333      ONIDA       DELHI     TV
444      SONY        MUMBAI    MOBILE
(1 Mark for writing correct output)
NOTE: Only three options would be awarded

[16] Write a function search_replace() in Python which accepts a list L of numbers and a number to be searched. If the number exists, it is replaced by 0 and if the number does not exist, an appropriate message is displayed.
Example :
L = [10,20,30,10,40]
Number to be searched = 10
List after replacement :
L = [0,20,30,0,40]

Ans.:

def search_replace(L,SN):
   Found=False # or Found=0
   for i in range(len(L)):
      if L[i]==SN:
         L[i]=0
         Found=True # or Found=1
      if Found==False: # if Found==0:
         print('Number not found')
OR
def search_replace(L,SN):
     Found=False # or Found=0
     for i in range(len(L)):
         if L[i]==SN:
           L[i]=0
           Found=True # or Found=1
         else:
           print('Number not found')
(½ Mark for writing the function header correctly)
(½ Mark for passing the correct parameters)
(½ Mark for writing the correct loop)
(½ Mark for comparing the number from elements of L)
(½ Mark for assigning the compared element as 0)
(½ Mark for displaying appropriate message when no matching element found)

[17] A list contains following record of course details for a University :
[Course_name, Fees, Duration]
Write the following user defined functions to perform given operations on the stack named ‘Univ’ :
(i) Push_element() – To push an object containing the Course_name, Fees and Duration of a course, which has fees greater than 100000 to the stack.
(ii) Pop_element() – To pop the object from the stack and display it. Also, display “Underflow” when there is no element in the stack.

Ans.:

For example :
If the lists of courses details are :
[“MCA”, 200000, 3]
[“MBA”, 500000, 2]
[“BA”, 100000, 3]
The stack should contain
[“MBA”, 500000, 2]
[“MCA”, 200000, 3]

Ans.:

Univ=[]
def Push_element(Course):
  for Rec in Course:
      if Rec[1]>100000:
          Univ.append(Rec)
def Pop_element():
   while len(Univ)>0:
        print(Univ.pop())
    else: 
        print("Underflow")

OR
Course=[["MCA",200000,3],["MBA",500000,2],["BA",100000,3]]
Univ=[]
def Push_element():
   for Rec in Course:
      if Rec[1]>100000:
         Univ.append(Rec)

def Pop_element():
    while len(Univ)>0:
       print(Univ.pop())
    else: 
       print("Underflow")

Any other correct equivalent code
(½ Mark for writing function header Push_element correctly with or without
argument)
(½ Mark for processing and checking each element of the courses list)
(½ Mark for appending the matched data into the stack Univ)
(½ Mark for writing function header Pop_element correctly with or without
argument)
(½ Mark for popping and displaying the objects from Univ)
(½ Mark for checking Underflow condition and displaying appropriate message)

[18] (a) Consider the following tables – LOAN and BORROWER:
Table : LOAN

Important PYQs Computer Science Class 12

Table: BORROWER

Important PYQs Computer Science Class 12

How many rows and columns will be there in the natural join of these two tables ?

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

TABLE: WORKER

Important PYQs Computer Science Class 12

(i) SELECT F_NAME, CITY FROM WORKER ORDER BY STATE DESC;

(ii) SELECT DISTINCT (CITY) FROM WORKER;

(iii) SELECT F_NAME, STATE FROM WORKER WHERE L_NAME LIKE ‘_HA%’;

(iv) (iv) SELECT CITY, COUNT (*) FROM WORKER GROUP BY CITY;

Ans.:

(a) 
Rows : 2
Columns : 4
(½ Mark each for correct values of Rows and Columns)

(b) 
(i)
F_NAME           CITY
-------          ---------------------
SAHIL            KANPUR
VEDA             KANPUR
SAMEER           ROOP NAGAR
MAHIR            SONIPAT
MARY             DELHI
ATHARVA          DELHI
(ii) 
CITY
-------------------
KANPUR
ROOP NAGAR
DELHI
SONIPAT
(iii)
F_NAME             STATE
--------------     ------------------------
SAHIL              UTTAR PRADESH
MAHIR              HARYANA
ATHARVA            DELHI
VEDA               UTTAR PRADESH
(iv)
CITY              COUNT (*)
-------------     -----------------
KANPUR             2
ROOP NAGAR         1
DELHI              2
SONIPAT            1
(½ Mark for writing the correct output)
Note for (i) to (iv) :
1. Ignore the output header and cases of the outputs
2. ½ mark for each query, for writing any 2 correct rows in the output
3. Order of the output rows/columns should be ignored.

[19] Write the definition of a Python function named LongLines( ) which reads the contents of a text file named ‘LINES.TXT’ and displays those lines from the file which have at least 10 words in it.

For example, if the content of ‘LINES.TXT’ is as follows :
Once upon a time, there was a woodcutter
He lived in a little house in a beautiful, green wood.
One day, he was merrily chopping some wood.
He saw a little girl skipping through the woods, whistling happily.
The girl was followed by a big gray wolf.

Then the function should display output as :
He lived in a little house in a beautiful, green wood.
He saw a little girl skipping through the woods, whistling happily.

Ans.:

def LongLines():
   myfile=open('LINES.TXT') # ignore 'r' mode
   all_lines=myfile.readlines()
   for aline in all_lines:
      if(len(aline.split()>=10):
          print(aline)
    myfile.close()

OR
def LongLines():
     with open ('LINES.TXT') as myfile: # ignore 'r' mode
        all_lines=myfile.readlines()
        for aline in all_lines:
           if(len(aline.split())>=10):
               print(aline)

OR
myfile=open('LINES.TXT') # ignore 'r' mode
s1=" "
while s1:
   s1=myfile.readline()
   words=s1.split()
   if(len(words)>=10):
      print(s1)
myfile.close()

(½ mark for the function header)
(½ mark for opening the file)
(½ mark for reading the file correctly)
(1 mark for checking the number of words in each line)
(½ mark for displaying the desired lines)

[20] Write a function count_Dwords() in Python to count the words ending with a digit in a text file Details.txt”.
Example:
If the file content is as follows:
On seat2 VIP1 will sit and
On seat1 VVIP2 will be sitting

Output will be:
Number of words ending with a digit are 4

Ans.:

def count_Dwords():
   with open ("Details.txt", 'r') as F: # ignore 'r'
   S=F.read()
   Wlist = S.split()
   count = 0
   for W in Wlist:
       if W[-1].isdigit():
         count+=1
   print("Number of words ending with a digit are",count)

OR
def count_Dwords():
   count=0
   myfile=open("Details.txt")
   S=myfile.read()
   Wlist=S.split()
   for W in Wlist:
      if i[-1] in "0123456789":
          count=count+1
   myfile.close()
   print("Number of words ending with a digit are",count)

OR
def count_Dwords():
    myfile=open("Details.txt")
    count=0
    for line in myfile:
       s1=line.split()
       for i in s1:
          if i[-1] in "0123456789":
                count=count+1
       print("Number of words ending with a digit are",count)
     myfile.close()
(½ mark for the function header)
(½ mark for opening the file)
(½ mark for reading the file correctly)
(1 mark for checking the condition)
(½ mark for displaying the desired lines)

[21] (a) Write the outputs of the SQL queries (i) to (iv) based on the relations COMPUTER and SALES given below :
Table : COMPUTER

Important PYQs Computer Science Class 12
Important PYQs Computer Science Class 12

(i) SELECT MIN(PRICE), MAX(PRICE) FROM COMPUTER;

(ii) SELECT COMPANY, COUNT(*) FROM COMPUTER GROUP BY COMPANY HAVING COUNT(COMPANY) > 1;

(iii) SELECT PROD_NAME, QTY_SOLD FROM COMPUTER C, SALES S WHERE C.PROD_ID=S.PROD_ID AND TYPE = ‘INPUT’;

(iv) SELECT PROD_NAME, COMPANY, QUARTER FROM COMPUTER C, SALES S WHERE C.PROD_ID=S. PROD_ID;

(b) Write the command to view all databases.

Ans.:

(a)
(i) 
MIN(PRICE)               MAX(PRICE)
--------------           --------------------
           200                           4300
(ii) 
COMPANY                 COUNT(*)
---------------        -------------------
LOGITECH                                 2
CANON                                    2
(iii) 
PROD_NAME       QTY_SOLD         
-----------     -----------      
MOUSE                    3
KEYBOARD                 2
JOYSTICK                 2
(iv)
PROD_NAME          COMPANY            QUARTER     
----------------   ---------------    --------------
MOUSE              LOGITECH                       2
LASER PRINTER      CANON                          1
KEYBOARD           LOGITECH                       2
JOYSTICK           IBALL                          1
(½ mark for correct output)

(b) SHOW DATABASES;
(1 mark for writing the correct command)
Note: punctuation mark (;) and cases can be ignored.

[22] Write a function EOReplace() in Python, which accepts a list L of numbers. Thereafter, it increments all even numbers by 1 and decrements all odd numbers by 1.
Example :
If Sample Input data of the list is :
L=[10,20,30,40,35,55]
Output will be :
L=[11,21,31,41,34,54]

Ans.:

l=eval(input("Enter the list:"))
def EOReplace(L):
   for i in range(len(L)):
      if L[i]%2==0:
         L[i]=L[i]+1
      else:
         L[i]=L[i]-1
   print(L)
EOReplace(l)

(½ mark for correct function header)
(½ mark for getting the list)
(½ mark for correct loop)
(½ mark for checking the condition)
(½ mark for incrementing the even values)
(½ mark for decrementing the odd values)

[23] A list contains following record of customer : [Customer_name, Room Type]
Write the following user defined functions to perform given operations on the stack named ‘Hotel’ :
(i) Push_Cust() – To Push customers’ names of those customers who are staying in ‘Delux’ Room Type.
(ii) Pop_Cust() – To Pop the names of customers from the stack and display them. Also, display “Underflow” when there are no customers in the stack.
For example :
If the lists with customer details are as follows :
[“Siddarth”, “Delux”]
[“Rahul”, “Standard”]
[“Jerry”, “Delux”]

The stack should contain
Jerry
Siddharth

The output should be:
Jerry
Siddharth
Underflow

Ans.:

Hotel=[]
Customer=[["Siddarth","Delux"],["Rahul","Standard"],["Jer ry","Delux"]]
def Push_Cust():
    for rec in Customer:
      if rec[1]=="Delux":
        Hotel.append(rec[0])
def Pop_Cust():
    while len(Hotel)>0:
       print(Hotel.pop())
    else:
       print("Underflow")

OR
top=0
def Push_Cust(Hotel,Customer):
   global top
   for cust_rec in Customer:
      if cust_rec[1]=="Delux":
         Hotel.insert(top, cust_rec[0])
         top=top+1

def Pop_Cust(Hotel):
    global top
    while len(Hotel)>0:
      print(Hotel.pop())
      top=top-1
    else:
      print("Underflow")

(½ mark for defining correct function header (Push_Cust())
(½ mark for correct loop in function Push_Cust())
(½ mark for checking the condition and appending the data in Push_Cust())
(½ mark for defining correct function header (Pop_Cust())
(½ mark for correct loop in function Pop_Cust())
(½ mark for deleting and displaying the data in Pop_Cust())

[24] Write a function in Python, Push (Vehicle) where, Vehicle is a dictionary containing details of vehicles – {Car_Name: Maker}.
The function should push the name of car manufactured by ‘TATA’ (including all the possible cases like Tata, TaTa, etc.) to the stack.
For example:
If the dictionary contains the following data :
Vehicle={“Santro”:”Hyundai”,”Nexon”:”TATA”,”Safari”:”Tata”}
The stack should contain
Safari
Nexon

Ans.:

stack=[]
def Push(Vehicle) :
   for v_name in Vehicle :
      if Vehicle[v_name].upper()=="TATA" :
        stack.append(v_name)

OR
stack=[]
def Push(Vehicle) :
    for v_name in Vehicle :
       if Vehicle[v_name] in ("TATA", "TaTa","tata","Tata"):
         stack.append(v_name)

(½ mark for defining correct function header)
(½ mark for correct loop )
(1 mark for checking the condition )
(1 mark for appending the data)

[25] Write separate user defined functions for the following :
(i) PUSH(N) – This function accepts a list of names, N as parameter. It then pushes only those names in the stack named OnlyA which contain the letter ‘A’.
(ii) POPA(OnlyA) – This function pops each name from the stack OnlyA and displays it. When the stack is empty, the message “EMPTY” is displayed.
For example :
If the names in the list N are
[‘ANKITA’, ‘NITISH’, ‘ANWAR’, ‘DIMPLE’, ‘HARKIRAT’]
Then the stack OnlyA should store
[‘ANKITA’, ‘ANWAR’, ‘HARKIRAT’]
And the output should be displayed as
HARKIRAT ANWAR ANKITA EMPTY

Ans.:

def PUSH(N):
  OnlyA=[]
  for aName in N :
     if 'A' in aName :
       OnlyA.append(aName)

def POPA(OnlyA):
   while OnlyA :
     print(OnlyA.pop(), end=' ')
  else :
     print('EMPTY')

(½ mark for accessing all names from the list N)
(½ mark for checking whether the name from N contains the alphabet ‘A’ or not)
(½ mark for pushing/appending the desired names into the Stack OnlyA)
(½ Mark for popping names from the Stack OnlyA)
(½ mark for displaying popped names on the screen)
(½ Mark for displaying the message ‘EMPTY’ when the Stack OnlyA is empty)

[26] Write the following user defined functions :
(i) pushEven(N) – This function accepts a list of integers named N as parameter. It then pushes only even numbers into the stack named EVEN.
(ii) popEven(EVEN) – This function pops each integer from the stack EVEN and displays the popped value. When the stack is empty, the message “Stack Empty” is displayed.
For example:
If the list N contains :
[10,5,3,8,15,4]
Then the stack, EVEN should store
[10,8,4]
And the output should be
4 8 10 Stack Empty

Ans.:

def pushEven(N):
   EVEN=[]
   for z in N :
     if z%2==0 :
       EVEN.append(z)

def popEven(EVEN):
   while EVEN :
      print(EVEN.pop(), end=' ')
   else :
      print('Stack Empty')

(½ mark for accessing all integers from the list N)
(½ mark for checking whether the integer from N is even or not)
(½ mark for pushing/appending the desired integers into the Stack EVEN)
(½ mark for popping integers from the Stack EVEN)
(½ mark for displaying popped integers on the screen)
(½ mark for displaying the message ‘Stack Empty’ when Stack EVEN is empty)

[27] (a) A SQL table BOOKS contains the following column names:
BOOKNO,BOOKNAME, QUANTITY, PRICE, AUTHOR
Write the SQL statement to add a new column REVIEW to store the reviews of the book.

(b) Write the names of any two commands of DDL and any two commands of DML in SQL.

Ans.:

(a)
ALTER TABLE BOOKS ADD REVIEW VARCHAR(20) ;
(½ mark for writing ALTER TABLE BOOKS)
(½ mark for writing ADD REVIEW VARCHAR(any size);
OR ADD REVIEW CHAR(any size);)

(b)
DDL Commands : CREATE, DROP, ALTER (any two)
DML Commands : INSERT, DELETE, UPDATE etc. (any two)
(½ mark each for correctly writing any two DDL and any two DML commands)

[28] Rashmi has forgotten the names of the databases,tables and the structure of the tables that she had created in Relational Database Management System (RDBMS) on her computer.

(a) Write the SQL statement to display the names of all the databases present in RDBMS application on her computer.

(b) Write the statement which she should execute to open the database named “STOCK”.

(c) Write the statement which she should execute to display the structure of the table “ITEMS” existing in the above opened database “STOCK”.

Ans.:

(a) SHOW DATABASES ;
(b) USE STOCK;
(c) DESCRIBE ITEMS;
OR
DESC ITEMS;
(1 Mark for writing correct SQL command)

[28] Write the definition of a user defined function PushNV(N) which accepts a list of strings in the parameter N and pushes all strings which have no vowels present in it, into a list named NoVowel.
Write a program in Python to input 5 Words and push them one by one into a list named All.
The program should then use the function PushNV() to create a stack of words in the list NoVowel so that it stores only those words which do not have any vowel present in it, from the list All.
Thereafter, pop each word from the list NoVowel and display the popped word. When the stack is empty, display the message “EmptyStack”.
For example:
If the Words accepted and pushed into the list All are
[‘DRY’, ‘LIKE’, ‘RHYTHM’, ‘WORK’, ‘GYM’]

Then the stack NoVowel should store
[‘DRY’, ‘RHYTHM’, ‘GYM’]
And the output should be displayed as
GYM RHYTHM DRY EmptyStack

Ans.:

def PushNV(N):
  for W in N :
     for C in W :
        if C.upper() in 'AEIOU':
          break
        else:
          NoVowel.append(W)
All=[]
NoVowel=[]
for i in range(5) :
    All.append(input('Enter a Word: '))
PushNV(All)

while NoVowel :
    print(NoVowel.pop(), end=' ')
else :
print('EmptyStack')

(½ mark for checking vowels correctly, ignore case sensitivity)
(½ mark for pushing strings into the stack NoVowel)
(½ mark for reading 5 words from the users)
(½ mark for assigning 5 words into All)
(½ mark for writing correct code to pop and display the words from NoVowel)
(½ mark for writing correct code to check empty stack and display the message
'EmptyStack')

[29] Write the definition of a user defined function Push3_5(N) which accepts a list of integers in a parameter N and pushes all those integers which are divisible by 3 or divisible by 5 from the list N into
a list named Only3_5.
Write a program in Python to input 5 integers into a list named NUM. The program should then use the function Push3_5() to create the stack of the list Only3_5. Thereafter pop each integer from the list
Only3_5 and display the popped value. When the list is empty, display the message “StackEmpty”.

For example:
If the integers input into the list NUM are :
[10,6,14,18,30]
Then the stack Only3_5 should store
[10,6,18,30]
And the output should be displayed as
30 18 6 10 StackEmpty

Ans.:

def Push3_5(N):
    for i in N :
      if i%3==0 or i%5==0 :
        Only3_5.append(i)
NUM=[]
Only3_5=[]

for i in range(5):
   NUM.append(int(input('Enter an Integer: ')))

Push3_5(NUM)

while Only3_5 :
     print(Only3_5.pop(), end=' ')
else :
     print('StackEmpty')

(½ mark for checking divisibility correctly)
(½ mark for pushing integers into the stack Only3_5)
(½ mark for reading 5 integers from the users)
(½ mark for assigning those 5 integers into NUM)
(½ mark for writing correct code to pop and display the integers from Only3_5)
(½ mark for writing correct code to check empty stack and display the message
'StackEmpty')

[30] (i) A SQL table ITEMS contains the following columns:
INO, INAME, QUANTITY, PRICE, DISCOUNT
Write the SQL command to remove the column DISCOUNT from the table.

(ii) Categorize the following SQL commands into DDL and DML :
CREATE, UPDATE, INSERT, DROP

Ans.:

(i) 
ALTER TABLE ITEMS DROP COLUMN DISCOUNT;
OR
ALTER TABLE ITEMS DROP DISCOUNT;
(½ mark for writing ALTER TABLE ITEMS)
(½ mark for writing DROP COLUMN DISCOUNT OR DROP DISCOUNT)

(ii) 
DDL Commands : CREATE, DROP
DML Commands : INSERT, UPDATE
(½ Mark each for writing the correct DDL/DML commands)

[31] Rohan is learning to work upon Relational Database Management System (RDBMS) application. Help him to perform following tasks:

(a) To open the database named “LIBRARY”.

(b) To display the names of all the tables stored in the opened database.

(c) To display the structure of the table “BOOKS” existing in the already opened database “LIBRARY”.

Ans.:

(a) USE LIBRARY ;
(b) SHOW TABLES;
OR
SHOW TABLES FROM LIBRARY;
(c) DESCRIBE BOOKS ;
OR
DESC BOOKS ;
1 mark for correct command

4 marks questions

[1] Write SQL queries for (a) to (d) based on the tables PASSENGER and FLIGHT given below:
Table : PASSENGER

PNONAMEGENDERFNO
1001SureshMALEF101
1002AnitaFEMALEF104
1003HarjasMALEF102
1004NitaFEMALEF103

Table: FLIGHT

FNOSTARTENDF_DATEFARE
F101MUMBAICHENNAI2021-12-254500
F102MUMBAIBENGALURU2021-11-204000
F103DELHICHENNAI2021-12-105500
F104KOLKATAMUMBAI2021-12-204500
F105DELHIBENGALURU2021-01-155000

(a) Write a query to change the fare to 6000 of the flight whose FNO is F104.

(b) Write a query to display the total number of MALE and FEMALE PASSENGERS.

(c) Write a query to display the NAME, corresponding FARE and F_DATE of all PASSENGERS who have a flight to START from DELHI.

(d) Write a query to delete the records of flights which end at Mumbai.

Ans.:

(i) UPDATE FLIGHT SET FARE=6000 WHERE FNO="F104";
(½ Mark for writing UPDATE FLIGHT)
(½ Mark for writing SET FARE=6000 WHERE FNO="F104")
(ii) SELECT GENDER, COUNT(*) FROM PASSENGER GROUP BY GENDER;
OR
SELECT COUNT(*) FROM PASSENGER GROUP BY GENDER;
(½ mark for writing SELECT part correctly)
(½ mark for writing GROUP BY GENDER; )
OR
(any alternate correct uses of COUNT() is acceptable)
(iii) SELECT NAME, FARE, F_DATE FROM PASSENGER P, FLIGHT F
WHERE F.FNO= P.FNO AND START = 'DELHI';
OR
SELECT NAME, FARE, F_DATE FROM PASSENGER, FLIGHT
WHERE PASSENGER.FNO= FLIGHT.FNO AND START = 'DELHI';
OR
SELECT NAME, FARE, F_DATE FROM PASSENGER, FLIGHT
WHERE PASSENGER.FNO= FLIGHT.FNO AND START LIKE 'DELHI';
OR
SELECT NAME,FARE,F_DATE FROM PASSENGER NATURAL JOIN FLIGHT
WHERE START = 'DELHI';
(½ mark for writing SELECT - FROM part correctly)
(½ mark for writing WHERE part correctly)
(iv) DELETE FROM FLIGHT WHERE END = "MUMBAI";
OR
DELETE FROM FLIGHT WHERE END LIKE "MUMBAI";
(½ mark for writing DELETE FROM FLIGHT)
(½ mark for writing WHERE part correctly)

[2] (i) Differentiate between Bus Topology and Tree Topology. Also, write one advantage of each of them.

OR

Differentiate between HTML and XML.

(ii) What is a web browser ? Write the names of any two commonly used web browsers.

Ans.:

(i)

Bus topology layout
Important PYQs Computer Science Class 12
Bus TopologyTree Topology
In bus topology, each communicating device connects to a single transmission medium, known as bus.It is a hierarchical topology, in which there are multiple branches and each branch can have one or more basic topologies like star, ring and bus.
It is very cost-effective as compared to other network topologies.It is easier to set-up multi-level plans for the network.

(1 Mark for mentioning any one correct difference between the topologies)
(½ mark each for writing any one advantage of Bus and Tree Topologies)
OR
(½ mark each for conveying correct understanding of Bus and Tree Topology
using/not using diagram)
(½ mark each for writing any one advantage of Bus and Tree Topologies)

OR

FeatureXML (eXtensible Markup Language)HTML (HyperText Markup Language)
PurposeStores and transports dataDisplays and formats data on web pages
StructureStrict, well-formedFlexible, can have missing tags
CustomizationUser-defined tags (<book>, <price>)Predefined tags (<h1>, <p>)
Case SensitivityCase-sensitive (<Data> ≠ <data>)Case-insensitive (<TITLE> = <title>)
Tag ClosingMandatory (<tag></tag> or <tag/>)Some tags can be unclosed (<br>, <img>)
Error HandlingStrict, errors make the document invalidLenient, browsers ignore minor errors
Data HandlingFocuses on carrying and structuring dataFocuses on displaying content
UsageUsed in APIs, configuration files, and data storageUsed for web page layout and formatting

(Full 2 Marks for writing any one correct difference between HTML and XML)
OR
(1 Mark for writing correct explanation of HTML)
OR
(½ Mark for writing full form of HTML)
(1 Mark for writing correct explanation of XML)
OR
(½ Mark for writing full form of XML

(ii) A Web browser is a software/tool, which allows us to view/access the content of WebPages.
OR
It is a Client software program that is used to access various kinds of Internet resources using HTTP.
Examples :
Google Chrome, Microsoft Edge, Mozilla Firefox, Apple Safari, Opera, Chromium, etc. (ANY TWO)

[3] Galaxy Provider Ltd. is planning to connect its office in Texas, USA with its branch at Mumbai. The Mumbai branch has 3 Offices in three blocks located at some distance from each other for different operations – ADMIN, SALES and ACCOUNTS.
As a network consultant, you have to suggest the best network related solutions for the issues/problems raised in (a) to (d), keeping in mind the distances between various locations and other given parameters.
Layout of the Offices in the Mumbai branch:

Important PYQs Computer Science Class 12

Shortest distances between various locations:

ADMIN Block to SALES Block300 m
SALES Block to ACCOUNTS Block175 m
ADMIN Block to ACCOUNTS Block350 m
MUMBAI Branch to TEXAS Head Office1400 km

Number of Computers installed at various locations are as follows:

ADMIN255
ACCOUNTS75
SALES30
TEXAS Head Office90

(a) It is observed that there is a huge data loss during the process of data transfer from one block to another. Suggest the most appropriate networking device out of the following, which needs to be placed along the path of the wire connecting one block office with another to refresh the signal and forward it ahead.
(i) MODEM

(ii) ETHERNET CARD

(iii) REPEATER

(iv) HUB

(b) Which hardware networking device out of the following, will you suggest to connect all the computers within each block ?
(i) SWITCH

(ii) MODEM

(iii) REPEATER

(iv) ROUTER

(c) Which service/protocol out of the following will be most helpful to conduct live interactions of employees from Mumbai Branch and their counterparts in Texas ?
(i) FTP

(ii) PPP

(iii) SMTP

(iv) VoIP

(d) Draw the cable layout (block to block) to efficiently connect the three offices of the Mumbai branch.

Ans.:

(a) (iii) REPEATER

(b) (i) SWITCH

(c) (iv) VoIP

(d)

cable layout for network

(1 mark for each correct answer)

[4] Write SQL queries for (a) to (d) based on the tables CUSTOMER and TRANSACT given below:

join query tables for class 12 computer science

(a) Write the SQL statements to delete the records from table TRANSACT whose amount is less than 1000.

(b) Write a query to display the total AMOUNT of all DEBITs and all CREDITs.

(c) Write a query to display the NAME and corresponding AMOUNT of all CUSTOMERs who made a transaction type (TTYPE) of CREDIT.

(d) Write the SQL statement to change the Phone number of customer whose CNO is 1002 to 9988117700 in the table CUSTOMER.

Ans.:

(a) DELETE FROM TRANSACT WHERE AMOUNT<1000;
(½ Mark for writing DELETE FROM TRANSACT)
(½ Mark for writing WHERE AMOUNT<1000)
(b) SELECT TTYPE, SUM(AMOUNT)FROM TRANSACT GROUP BY TTYPE;
(½ Mark for writing SELECT TTYPE, SUM(AMOUNT) FROM TRANSACT)
(½ Mark for writing GROUP BY TTYPE)
(Note: No marks should be deducted, if TTYPE is not mentioned with SELECT)
(c) SELECT NAME, AMOUNT FROM CUSTOMER NATURAL JOIN TRANSACT WHERE TTYPE='CREDIT';
OR
SELECT NAME, AMOUNT FROM CUSTOMER C, TRANSACT T WHERE C.CNO=T.CNO AND TTYPE='CREDIT';
OR
SELECT NAME, AMOUNT FROM CUSTOMER, TRANSACT WHERE CUSTOMER.CNO=TRANSACT.CNO AND TTYPE='CREDIT';
(½ mark for writing SELECT - FROM part correctly)
(½ mark for writing WHERE part correctly)
(d) UPDATE CUSTOMER SET PHONE=9988117700 WHERE CNO=1002;
(½ mark for writing UPDATE - SET part correctly)
(½ mark for writing WHERE part correctly)

[5] (a) (i) Mention any two characteristics of BUS Topology.

OR

Differentiate between the terms Domain Name and URL in the context of World Wide Web.

Ans.:

(i)

  1. Each communicating device connects to a single transmission medium, known as BUS.
  2. Economic option of networking
  3. It offers simultaneous flow of data and control.
  4. Fault detection and isolation is difficult

(1 mark each for writing any two characteristics of BUS topologies)

(ii)

Refer Ans:35 in 2 marks questions

(b) Write the names of two wired and two wireless data transmission mediums.

Ans.: Wired Mediums: Twisted Pair, Fibre-Optic cable, Coaxial cable (Any two)
Wireless Mediums: Radio Waves, Microwaves, Infra-red waves (Any two)

(½ Mark for writing each correct name of wired medium)
(½ Mark for writing each correct name of wireless medium)

[6] The government has planned to develop digital awareness in the rural areas of the nation. According to the plan, an initiative is taken to set up Digital Training Centers in villages across the country with its Head Office in the nearest cities. The committee has hired a networking consultancy to create a model of the network in which each City Head Office is connected to the Training Centers situated in 3 nearby villages.
As a network expert in the consultancy, you have to suggest the best network-related solutions for the issues/problems raised in (a) to (d), keeping in mind the distance between various locations and other given parameters.
Layout of the City Head Office and Village Training Centers :

Buildings and block for case study based network question computer science class 12

Shortest distances between various Centers:

distance for case study questions computer science class 12

Number of Computers installed at various centers are as follows:

Village 1 Training Center10
Village 2 Training Center15
Village 3 Training Center15
City Head Office100

(a) It is observed that there is a huge data loss during the process of data transfer from one village to another. Suggest the most appropriate networking device out of the following, which needs to be placed along the path of the wire connecting one village with another to refresh the signal and forward it ahead.
(i) MODEM
(ii) ETHERNET CARD
(iii) REPEATER
(iv) HUB

(b) Draw the cable layout (location-to-location) to efficiently connect various Village Training Centers and the City Head Office for the above-shown layout.

(c) Which hardware networking device, out of the following, will you
suggest to connect all the computers within the premises of every
Village Training Center ?
(i) SWITCH
(ii) MODEM
(iii) REPEATER
(iv) ROUTER

(d) Which protocol, out of the following, will be most helpful in conducting online interactions between experts from the City Head Office and people at the three Village Training Centers?
(i) FTP
(ii) PPP
(iii) SMTP
(iv) VoIP

Ans.:

(a) (iii) REPEATER

(1 Mark for correct identification of the Networking Device)

(b)

Important PYQs Computer Science Class 12

(1 Mark for drawing correct cable layout)

(c) (i) SWITCH

(1 Mark for correct identification of the service/protocol)

(d) (iv) VoIP

(1 Mark for drawing correct cable layout)

[7] The school has asked their estate manager Mr. Rahul to maintain the data of all the labs in a table LAB. Rahul has created a table and entered data of 5 labs.

Computer Science board PYQ 4 marks

Based on the data given above, answer the following questions :

(i) Identify the columns which can be considered as Candidate keys.

(ii) Write the degree and cardinality of the table.

(iii) Write the statements to:
(a) Insert a new row with appropriate data.
(b) Increase the capacity of all the labs by 10 students which are on ‘I’ Floor.

(iv) Write the statements to :
(a) Add the constraint PRIMARY KEY to a column LABNO in the table.
(b) Delete the table LAB.

Ans.:

(i) Candidate keys: LABNO and LAB_NAME
(1 Mark for correctly writing both names of Candidate keys)
OR
(½ Mark for specifying any one candidate key correctly)
(ii) Degree = 5, Cardinality = 5
(½ Mark for writing value of Degree correctly)
(½ Mark for writing value of Cardinality correctly)
(iii) (a) INSERT INTO LAB VALUES('L006','PHYSICS','RAVI',25,'II');
(b) UPDATE LAB SET CAPACITY=CAPACITY+10 WHERE FLOOR='I';
(½ Mark for writing the INSERT INTO LAB part correctly)
(½ Mark for writing the VALUES part correctly)
(½ Mark for writing the UPDATE LAB SET part correctly)
(½ Mark for writing the CAPACITY=CAPACITY+10 WHERE FLOOR="I" part correctly)
(iv) (a) ALTER TABLE LAB ADD PRIMARY KEY (LABNO);
(b) DROP TABLE LAB;
(a) (½ Mark for writing ALTER TABLE LAB part correctly)
(½ Mark for writing ADD PRIMARY KEY(LABNO) part correctly)
(b) (1 Mark for writing query correctly)

[8] Shreyas is a programmer, who has recently been given a task to write a user defined function named write_bin() to create a binary file called Cust_file.dat containing customer information – customer number (c_no), name (c_name), quantity (qty), price (price) and amount (amt) of each customer.
The function accepts customer number, name, quantity and price. Thereafter, it displays the message ‘Quantity less than 10 ….. Cannot SAVE’, if quantity entered is less than 10. Otherwise the function calculates amount as price * quantity and then writes the record in the form of a list into the binary file.

import pickle
def write_bin():
   bin_file=_______ #Statement 1
   while True:
      c_no=int(input("enter customer number"))
      c_name=input("enter customer name")
      qty=int(input("enter qty"))
      price=int(input("enter price"))
      if ________ #Statement 2
              print("Quantity less than 10..Cannot SAVE")
      else:
              amt=price * qty
              c_detail=[c_no,c_name,qty,price,amt]
              ________ #Statement 3
              ans=input("Do you wish to enter more records y/n")
              if ans.lower()=='n':
                 ________ #Statement 4
     _________________ #Statement 5
______________________ #Statement 6

(i) Write the correct statement to open a file ‘Cust_file.dat’ for writing the data of the customer.

(ii) Which statement should Shreyas fill in Statement 2 to check whether quantity is less than 10.

(iii) Which statement should Shreyas fill in Statement 3 to write data to the binary file and in Statement 4 to stop further processing if the user does not wish to enter more records.

(iv) What should Shreyas fill in Statement 5 to close the binary file named Cust_file.dat and in Statement 6 to call a function to write data in binary file?

Ans.:

(i) Statement 1: open ("Cust_file.dat", "wb")
(1 Mark for correctly writing missing Statement 1)
Note: 'ab' mode also be considered
(ii) Statement 2: qty<10 :
(1 Mark for correctly writing missing Statement 2)
(iii) Statement 3: pickle.dump(c_detail,bin_file)
Statement 4: break
(1 Mark for correctly writing missing Statement 3)
(1 Mark for correctly writing missing Statement 4)
(iv) Statement 5: bin_file.close()
Statement 6: write_bin()
(1 Mark for correctly writing missing Statement 5)
(1 Mark for correctly writing missing Statement 6)

[9] Atharva is a programmer, who has recently been given a task to write a Python code to perform the following binary file operation with the help of a user defined function/module :
Copy_new() : to create a binary file new_items.dat and write all the item details stored in the binary file, items.dat, except for the item whose item_id is 101. The data is stored in the following format :
{item_id:[item_name,amount]}

import _________________# Statement 1
def Copy_new():
   f1=_____________ # Statement 2
   f2=_____________ # Statement 3
   item_id=int(input("Enter the item id"))
   item_detail=________________ # Statement 4
   for key in item_detail:
         if _________: # Statement 5
             pickle._____________ # Statement 6
f1.close()
f2.close()

He has succeeded in writing partial code and has missed out certain statements. Therefore, as a Python expert, help him to complete the code based on the given requirements :

(i) Which module should be imported in the program ? (Statement 1)

(ii) Write the correct statement required to open the binary file “items.dat”. (Statement 2)

(iii) Which statement should Atharva fill in Statement 3 to open the binary file “new_items.dat” and in Statement 4 to read all the details from the binary file “items.dat”.

(iv) What should Atharva write in Statement 5 to apply the given condition and in Statement
6 to write data in the binary file “new_items.dat”.

Ans.:

(i) pickle OR import pickle
(1 Mark for correctly writing missing module in Statement 1)

(ii) open("items.dat","rb") OR f1=open("items.dat","rb")
(1 Mark for correctly writing missing function in Statement 2)

(iii) 
open("new_items.dat","wb")
pickle.load(f1)

OR
f2=open("new_items.dat","wb")
item_detail = pickle.load(f1)
(1 Mark for correctly writing missing function/method in Statement 3)
(1 Mark for correctly writing missing function/method in Statement 4)

(iv) 
if key != 101:
pickle.dump(item_detail[key],f2) #OR any alternative valid code

OR
if key != item_id:
pickle.dump(item_detail[key],f2) #OR any alternative valid code
(1 Mark for correctly writing missing condition in Statement 5)
(1 Mark for correctly writing missing function/method in Statement 6

[10] The ABC Company is considering to maintain their salespersons records using SQL to store data. As a database administrator, Alia created the table Salesperson and also entered the data of 5 Salespersons.

Table : Salesperson

S_IDS_NAMEAGES_AMOUNTREGION
S001SHYAM3520000NORTH
S002RISHABH3025000EAST
S003SUNIL2921000NORTH
S004RAHIL3922000WEST
S005AMIT4023000EAST

(i) Identify the attribute that is best suited to be the Primary Key and why?

(ii) The Company has asked Alia to add another attribute in the table. What will be the new
degree and cardinality of the above table?

(iii) Write the statements to :
(a) Insert details of one salesman with appropriate data.
(b) Change the Region of salesman ‘SHYAM’ to ‘SOUTH’ in the table Salesperson.

(iv) Write the statement to :
(a) Delete the record of salesman RISHABH, as he has left the company.
(b) Remove an attribute REGION from the table.

Ans.:

(i) 
Primary key: S_ID
As it is non-repeating value and not expected to repeat for new rows too.
(½ Mark for identifying the correct attribute for Primary Key)
(½ Mark for appropriate explanation)
Note:
S_NAME should also be considered as a Primary Key

(ii) Degree = 6 and Cardinality = 5
(½ Mark for writing value of Degree correctly)
(½ Mark for writing value of Cardinality correctly

(iii) 
(a) INSERT INTO SALESPERSON
VALUES ("S006","JAYA",23,34000,'SOUTH');
(b) UPDATE SALESPERSON
SET REGION='SOUTH' WHERE S_NAME="SHYAM";
(½ Mark for writing the INSERT INTO SALESPERSON correctly)
(½ Mark for writing the any valid data using VALUES correctly)
(½ Mark for writing the UPDATE SALESPERSON correctly)
(½ Mark for writing the assignment operation with appropriate condition
correctly)

(iv) 
(a) DELETE FROM SALESPERSON
WHERE S_NAME="RISHABH";
(b) ALTER TABLE SALESPERSON
DROP COLUMN REGION;
(½ Mark for writing DELETE FROM correctly)
(½ Mark for writing WHERE condition correctly)
(½ Mark for writing ALTER TABLE correctly)
(½ Mark for writing DROP COLUMN correctly)

Leave a Reply


Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://api.aspose.cloud/connect/token` resulted in a `429 Too Many Requests` response in /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 Stack trace: #0 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/guzzlehttp/guzzle/src/Middleware.php(69): GuzzleHttp\Exception\RequestException::create() #1 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp\{closure}() #2 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler() #3 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}() #4 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Promise\TaskQueue->run() #5 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn() #6 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending() #7 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList() #8 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending() #9 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/guzzlehttp/guzzle/src/Client.php(123): GuzzleHttp\Promise\Promise->wait() #10 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/aspose-cloud/aspose-words-cloud/src/Aspose/Words/WordsApi.php(50640): GuzzleHttp\Client->send() #11 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/aspose-cloud/aspose-words-cloud/src/Aspose/Words/WordsApi.php(50648): Aspose\Words\WordsApi->_requestToken() #12 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/aspose-cloud/aspose-words-cloud/src/Aspose/Words/WordsApi.php(50654): Aspose\Words\WordsApi->_checkAuthToken() #13 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/aspose-cloud/aspose-words-cloud/src/Aspose/Words/WordsApi.php(50666): Aspose\Words\WordsApi->_getKey() #14 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/aspose-cloud/aspose-words-cloud/src/Aspose/Words/WordsApi.php(80): Aspose\Words\WordsApi->_checkRsaKey() #15 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/src/AsposeWords/Util.php(24): Aspose\Words\WordsApi->__construct() #16 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/src/AsposeWords/ExportEngine.php(87): AsposeWords\Util::getWordsApi() #17 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/src/AsposeWords/AutoExport.php(26): AsposeWords\ExportEngine->convert() #18 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-includes/class-wp-hook.php(324): AsposeWords\AutoExport->export() #19 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #20 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-includes/plugin.php(517): WP_Hook->do_action() #21 /home/u251245109/domains/tutorialaicsip.com/public_html/wp-includes/load.php(1279): do_action() #22 [internal function]: shutdown_action_hook() #23 {main} thrown in /home/u251245109/domains/tutorialaicsip.com/public_html/wp-content/plugins/aspose-doc-exporter/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113