Important Question Answer Class 12 Computer Science (Python)

Important Question  answer Class 12 Computer Science (Python) useful for Term 2 Examination. In this section you will find some important question answer class 12 Computer Science. These questions will help the Students having Subject Computer Science in Class 12. 


Topic: Computer Networking

Q. 1 Expand the following:



POP : Post Office Protocol

HTTP: Hypertext Transfer Protocol

ARPANET – Advanced Research Project Agency Network

VoIP : Voice over internet protocol


Q. 2 What is MAC address? Give example also.


The NIC manufacturer assign a unique physical address to each NIC cars, this physical address is known as MAC address. A MAC address is a 6-byye address with each byte separated by colon : Example 10:BS:04:56:2E:FC


Q. 3 Identify the type of topology on the basis of the following:

a) Since every node is directly connected to the server, a large amount of cable is needed which increases the installation cost of the network.

Ans: Star Topology


b) It has a single common data path connecting all the nodes.

Ans: Bus Topology


Q. 4 Define the following:

(i) RJ-45

Ans: RJ-45: RJ45 is a standard type of connector for network cables and networks. It is an 8-pin connector usually used with Ethernet cables.


Ans: Ethernet: Ethernet is a LAN architecture developed by Xerox Corp along with DEC and Intel. It uses a Bus or Star topology and supports data transfer rates of up to 10 Mbps. 


Q. 5 What is protocol? Name 5 commonly used protocols.


A protocol means the rules that are applicable for a network or we can say that the common set of rules used for communication in network.

Different types of protocols are :

(i) HTTP : Hyper Text Transfer Protocol

(ii) FTP : File Transfer Protocol

(iii) SLIP : Serial Line Internet Protocol

(iv) PPP : Point to Point Protocol

(v) TCP/IP : Transmission Control Protocol/ Internet Protocol.



Q. 6 Write two advantages and two disadvantages of network.

Advantages of network:

(i) We can share resources such as printers and scanners.

(ii) We can share data and access files from any computer.

Disadvantages of network:

(i) Network faults can cause loss of data.

(ii) If there is no privacy mechanism used then the entire network can be accessed by an unauthorized person.



Q. 7 Define the following data communicating devices:

(a) Repeater

Ans: It is a device that amplifies and restoresthe signal before it gets degraded and transmits the original signal back to the destination. A repeater is a regenerator and not an amplifier.



Ans: A gateway operates on all the seven layers of OSI model. A network gateway is a computer which has internet-working capability of joining together two networks that use different base protocols. Gateway converts one protocol to another and can, therefore, connect two dissimilar networks.


(c) 3G

Ans: 3G (Third Generation) mobile communication technology is a broadband, packet-based transmission of text, digitized voice, video and multimedia at data rates up to 2 mbps, offering a consistent set of services to mobile computer and phone users no matter where they are located in the world.



Ans: SMS (Short Message Service) is the transmission of short text messages to and from a mobile phone, fax machine and IP address.


(e) Modem

Ans: It is a device that converts digital signal to analog signal (modulator) at the sender’s site and converts back analog signal to digital signal (demodulator) at the receiver’s end, in order to make communication possible via telephone lines. It enables a computer to transmit data over telephone or cable lines.

(f) Bluetooth

It is used for exchanging data over a short distance from fixed and mobile devices. This type of media comes under PAN (Personal Area Network).


(g) URL: A uniform resource locator, abbreviated URL, also known as web address, is a specific character string that constitutes a reference to a resource. In most web browsers, the URL of a web page is displayed on top inside an address bar. A URL is a formatted text string used by web browsers.

(h) IP Address (Internet Protocol Address) :The Internet Protocol (IP) is the method or protocol by which data is sent from one computer to another on the Internet. Each computer (known as a host) on the Internet has atleast one IP address that uniquely identifies it from all other computers on the Internet.



Q.8 Write the two advantages and two disadvantages of Bus Topology in network

Ans: Advantage:

(i) Easy to connect a computer or peripheral to a linear bus.

(ii) Requires less cable length than a star topology.

Disadvantage :

(i) Slower as compared to tree and star topologies of network.

(ii) Breakage of wire at any point disturbs the entire network.



Q.9 Write one advantage of star topology over bus topology.

Ans: Advantage of star topology over bus topology :

(i) The star topology is the most reliable as there is a direct connection of every nodes in the network with the central node, so any problem in any node will affect the particular node only.


Q. 10 Give some advantages and disadvantages of Radiowave


(i) Cheaper than wired network.

(ii) Provides mobility.

(iii) Easy to use over difficult terrain.


(i) Insecure communication can be easily taped.

(ii) It is affected by the weather conditions such as rain, storms, thunder, etc


Q. 11 What is the difference between star topology and bus topology of network?


Star Topology: All the nodes are directly connected with the central node or server. Easy to detect faults. It is fast in transmission.

Bus topology: There is a single length of transmission medium on which various nodes are attached and the server can be anywhere in the transmission cable. Faults cannot be easily detected. Becomes slow with increase in node


Q. 12 Write one advantage and one disadvantage of using Optical fiber cable


(i) Not susceptible to electrical and magnetic interference i.e. free from EMI.

(ii) High speed and Data Transmission capacity

(iii) Secure Transmission


(i) Expensive and not suitable for domestic use.

(ii) Fibers are fragile so installation is typical job.

(iii) Difficult to solder/extend.


Q. 13 Give one advantage and one disadvantage of Bus topology

Bus topology: A bus topology is an arrangement in which the computers and the peripheral devices are connected to a common single data line.

Advantage: All the nodes are connected directly, so very short cable length is required.

Disadvantage: In case of any fault occurred in data transmission, fault isolation is very difficult. We have to check the entire network to find the fault.


 Q. 14 Write two characteristics of Wi-Fi.

(i) It is wireless network.

(ii) It is for short range


Important Question Answer Class 12 Computer Science for Term 2

Topic: Database

2 Marks Questions


Q. 1 What is the difference between Primary Key and Foreign Key?

Primary key is the key which uniquely identifies a tuple but foreign key is the key which takes reference from primary key

There is only one primary key in a table but there can be multiple foreign key on a table


Q. 2 Explain the following results retrieval methods with examples. fetchone () rowcount ()


fetchone() :- The fetchone() method will return only one row from the result set in the form of tuple containing a record.

rowcount() :- cursor.rowcount() that always return how many records have been retrieved so for using any of the fetch () methods.


Q. 3 Which keyword is used to remove duplicate records from relation.

Ans: distinct


Q. 4 Write two wild card characters which are used with like operator?

% and underscore( _ )


Q. 5 A table “Design” in a database has 5 columns and 2 records. What is the degree and cardinality of this table?


Degree – 5



Q. 6 What is the difference between where and having clause in SQL.

Ans: Where is used with single row function where as having is used with group row function.

example- select designation,sum(salary) from desig group by designation having count(*) < 3;

select sum(benefits) from workers where designation = ‘salesman’;


Q. 7 Write a small python program to insert a record in the table books with attributes (title ,isbn).


import mysql.connector as Sqlator

conn =sqlator.connect(host=”localhost”, user=”root”, passwd=”12345″, database=”test”)


query=”INSERT into books(title,isbn) values(‘{}’{})”.format(‘Neelesh’,’5143’)




Q. 8 What is constraint?

Ans: A constraints is a condition or check application on a field or set of fields.

Example: NOT NULL (ensure that column con not have null value), CHECK (make sure that all value

satisfy certain criteria), UNIQUE (ensure that all values in a column are different) etc.


Q. 9 What are single row functions ?

Ans: Single Row Function work with a single row at a time. A single row function returns a result for every row of a quired table

Examples of Single row functions are Sqrt(), Concat(), Lcase(), Upper(), Day(), etc.


Q. 10  Make difference between DELETE and DROP command. Explain with suitable examples of each.

DELETE is DML command while DROP is a DDL command. Delete is used to delete rows from a table while DROP is used to remove the entire table from the database.


Q. 11 Differentiate between Alter and Update Command. 

Alter command in DDL command but update command is DML Command.

Alter command is used to add,modify and delete a column from the table and update command is used to make changes in the record of the table



Q. 12 Write the code to create the connection in which database’s name is Python, name of host, user and password can taken by user. Also, print that connection.


import mysql.connector

mycon = mysql.connector.connect( host = “localhost”, user = “root”, passwd = “12345”, database = “Python”)



Q. 13 Which command is used to delete a table in a database?



Q. 14 Define natural join.

Natural Join: The join in which only one of the identical columns existing in both tables is present, No duplication of columns.


Q. 15 What is a primary key? How many primary keys can be there in a table?

It is a combination of one or more fields in a table that can uniquely identify a record. There can be only one primary key in a table. It plays an important role in identifying the records, because it is the primary key who carries unique values. The criteria for a field to become primary key is : It must be carrying unique and NOT NULL values.


Q. 16 Differentiate between fetchone() and fetchall() methods.


fetch(): It returns the next row from the result set as tuple.If there are no more rows to retrieve, None is returned.

fetchall():It fetches all the rows of a query result. It returns all the rows as a list of tuples. An empty list is returned if there is no record to fetch.


Q. 17 Which command is used to view the list of databases in a server?



Q. 18 Define equi-join with example.

Equi join is a simple SQL join condition that uses equal sign as a comparison operator.


SELECT col1, col2, col3 FROM table1, table2

WHERE table1.col1 = table2.col1;



Q. 19 What is connection? What is its role?

A Connection (represented through a connection object) is the session between the application program and the database. To do anything with database, one must have a connection object.


Q. 20 Which package must be imported in Python to create a database connectivity application?

Ans: mysql.connector.


Q. 21 What do you mean by data redundancy?

Ans. Duplication of data in a table is called redundancy.


Q. 22 What do you mean by data integrity?

Ans: Data integrity means maintaining accuracy and consistency of data.



Topic: Data Structure

2 Marks Questions

Q.1 Write a function pop() which remove name from stack named “MyStack”


def Pop(MyStack):

if len(MyStack) > 0:



print(“Stack is empty.”)


Q.2 Write a function Push() which takes number as argument and add in a stack “MyValue”.



def Push(value):



Q. 3 Write an algorithm for pop operation in stack


Algorithm Steps

Step 1. if (Top == − 1) write “Stack is empty” and go to step 4

Step 2. ITEM = data [Top]

Step 3. Top = Top − 1

Step 4. Stop.


Q.4 Define stack. What is the significance of TOP in stack.


A stack is an abstract data type and a linear or user defined data structure based on the principle of Last In First Out (LIFO).

A stack is a list where insertion and deletion can take place only at one end called Top.


Q. 5 What is push operation in stack?


Push operation refers to inserting an element in the stack. Since there’s only one position at which the new element can be inserted — Top of the stack, the new element is inserted at the top of the stack.


3 marks questions


Q. 6 Write a function in Python PUSH_IN(L), where L is a list of numbers. From this list, push all even numbers into a stack which is implemented by using another list.




def PUSH_IN(L): # Allow additions to the stack

for i in L:

if i%2==0:





Q. 7 Write a function in Python POP_OUT(Stk), where Stk is a stack implemented by a list of numbers. The function returns the value which is deleted/popped from the stack.


def isEmpty(stk): # checks whether the stack is empty or not

if stk==[]:

return True


return False

def POP_OUT(stk):

if isEmpty(stk): # verifies whether the stack is empty or not

print(&quot;Stack Underflow&quot;)

else: # Allow deletions from the stack


if len(stk)==0:




return item


Q.8 Write a function in Python PUSH(Arr), where Arr is a list of numbers. From this list push all numbers divisible by 5 into a stack implemented by using a list. Display the stack if it has at least one element, otherwise display appropriate error message.


def PUSH(Arr,value):


for x in range(0,len(Arr)):

if Arr[x]%5==0:


if len(s)==0:

print(“Empty Stack”)




Q. 9 Write a function in Python POP(Arr), where Arr is a stack implemented by A list of numbers. The function returns the value deleted from the stack.


def popStack(st) :

# If stack is empty

if len(st)==0:



L = len(st)





Q. 10 Pramod has created a dictionary containing EMPCODE and SALARY as key value pairs of 5 Employees of Parthivi Constructions. Write a program, with separate user defined functions to perform the following operations:

(i)Push the keys (Employee code) of the dictionary into a stack, where the corresponding value (Salary) is less than 25000.

(ii) Pop and display the content of the stack.

For example:

If the sample content of the dictionary is as follows:

EMP={“EOP1”:16000, “EOP2”:28000, “EOP3”:19000, “EOP4”:15000, “EOP5”:30000}

The output from the program should be:




EMP={“EOP1”:16000, “EOP2”:28000,

“EOP3”:19000, “EOP4”:15000, “EOP5”:30000}

def PUSH(S,N):


def POP(S):

if S!=[]:

return S.pop()


return None


for k in EMP:

if EMP[k]<25000:


while True: if


print(POP(ST),end=” “)




Question Bank Computer Science (083) for Class 12

Q. 11 Aryan has a list containing 10 integers. You need to help him create a program with separate user defined functions to perform the following operations based on this list.

(i) Traverse the content of the list and push the odd numbers into a stack.

(ii) Pop and display the content of the stack.

For Example:

If the sample Content of the list is as follows:

Num=[31, 55, 76, 89, 21, 45, 76, 68 ]

Sample Output of the code should be:

45 21 89 31



Num=[31, 55, 76, 89, 21, 45, 76, 68 ]

def PUSH(S,N):


def POP(S):

if S!=[]:

return S.pop()


return None


for k in N:

if k%2!=0:


while True:

if ST!=[]:

print(POP(ST),end=” “)




Q. 12 Ashish students of class XII wants to enter details of student’s- Rollno, Name and grade in a stack. Help him to write Push() methods in Python to add student’s details. Display the student’s details.


def push(stack):


s.append(input(“Enter student rollno?”))

s.append(raw_input(“Enter student name”))

s.append(raw_input(“Enter student grade”))


def display (stack):



for i in range(l-1,-1,-1):

print stack[i]


print “Creating Stack”

n = input(“Enter the number of students”)

for i in range(n):

student = []

student.append(input(“Enter student rollno?”))

student.append(raw_input(“Enter student name”))

student.append(raw_input(“Enter student grade”))

stack, append(student) push(stack)




Q. 13 Write a program to implement a stack for the students(studentno, name). Just implement Pop and display.




def POP():




print(“Student details are:”, stk.pop())


def display():






for i in range(t-1,-1,-1):





Q. 14 Write a function in python, MakePush(Package) and MakePop(Package) to add a new Package and delete a Package from a List of Package Description, considering them to act as push and pop operations of the Stack data structure.


def MakePush(Package):

a=int(input(“enter package title : “))


def MakePop(Package):

if (Package==[]):

print( “Stack empty”)


print (“Deleted element:”,Package.pop())


Q. 15 Write a function in python, Push(Stu) and MakePop(Stu) to add a new student and delete student from a List of Stu contain rollno, Sname and Class as list, considering them to act as push and pop operations of the Stack data structure


def Push(Stu):

rollno=int(input(“enter package title : “))

Sname=int(input(“enter package title : “))

Class=int(input(“enter package title : “))



def Pop(Stu):

if (Stu==[]):

print( “Stack empty”)


print (“Deleted element:”,Stu.pop())


These were some important question answer class 12 Computer Science. Hope You fill find them helpful for your board examination. 



Also Check:

Computer Science Sample Paper Class 12 Term 2 Set 1

Computer Science Sample Paper Class 12 Term 2 Set 2

Computer Science Sample Paper Class 12 Term 2 Set 3

Computer Science Sample Paper Class 12 Term 2 Set 4

Computer Science Sample Paper Class 12 Term 2 Set 5

Computer Science Sample Paper Class 12 Term 2 set 6

Computer Networking Question and Answer

Database Management System Questions with Answer



Copywrite © 2020-2024, CBSE Python,
All Rights Reserved
error: Content is protected !!