Solved Practice Test Computer Science Python Class 12 Term 2 Exam according to the new CBSE syllabus. Practice Test of CBSE class 12 board exam includes Short /conceptual, Application based, descriptive questions with solutions.
Term 2 Syllabus of CBSE Class 12 computer Science (Python) includes:
Stacks :5 marks,
Networking :10 marks,
Database and SQL : 20 marks.
Practice Test CS Class 12 Term 2 Exam
Total marks : 35
Total Time : 2 Hrs
N.O of Questions : 13
Q.1.What are push and pop operations ?( 2 mark)
Answer:
A new data element can only be added to the top of the stack , this insertion of element in a stack is technically called “push”. Data can only be removed from the top in a stack , this removal of element from a stack is technically called “pop”.
l=[4,5,6,7]
push 8 # l =[4,5,6,7,8]
pop #8 is popped, l=[4,5,6,7]
Q.2.Give some examples of stack applications. ( 2 mark)
Answer:
Stack has various applications. some of them are :
i)Reversal of string
ii)In fix to Postfix
iii) Undo feature in text editors
Q3. When would you prefer (2 mark)
(i) bridges over hubs ( 1 mark)
(ii) switch over other network devices? ( 1 mark)
Answer :
(i) We would prefer bridges over hubs when we need to connect multiple networks.
(ii) We would prefer switch over others network devices when want to segment networks into different sub-networks to prevent traffic overloading.
Q.4. a)Which function do you use in ORDER BY clauses to specify custom sort order?(1 mark)
Answer: We use ASC or DESC keyword.
b) Write an example query that sorts on three columns.(1mark)
Answer: SELECT * FROM STUDENT ORDER BY PROJECT-GROUP , SECTION , MARKS ;
Q.5.What are hubs? How are active hubs different from passive hubs?(2 marks)
Answer:
Hardware device used to connect several computers together.
Types of hub-
a)Active hubs- also connect plus repeat the signal
b)Passive hubs- signal is passed from one computer to another.
Q6.a)Insert all those records of table Accounts into table Pending where amt_ outstanding is more than 10000. ( 2 marks)
Answer:
Create table Pending as
Select * from Accounts
Where amt_outstanding > 10000 ;
Q.6.b) Add a constraint (NN-Grade) in table Empl that declares column Grade not null. ( 2 marks)
Answer:
Alter table Empl modify column grade int(1) Not null;
Q.7. a) Mr. Mittal is using a table with following columns: ( 2 marks)
Name, Class, Stream_ld, Stream_name
He needs to display names of students who have not been assigned any stream or have been assigned stream_name that ends with “computers”.
He wrote the following command, which did not give the desired result.
SELECT Name, Class FROM Students
WHERE Stream_name = NULL OR Stream_name = “%computers” ;
Help Mr. Mittal to run the query by removing the error and write correct query.
Answer:
SELECT Name, Class FROM Students
WHERE Stream_name is NULL OR Stream_name like “%computers” ;
Q.7. b)Sarthak, a student of class XII, created a table “Class”. Grade is one of the columns of this table. 10 i the details of students whose Grades have not been entered, he wrote the following MySql query, which did not give the desired result:
SELECT * FROM Class WHERE Grade = “Null”;
Help Sarthak to run the query by removing the errors from the query and write the correct query. ( 2 marks)
Answer: SELECT * FROM Class WHERE Grade is Null ;
Q8. Write a program that depending upon user’s choice, either pushes or pops an element in a stack the elements are shifted towards right so that top always remains at 0th (zero) index. ( 3 marks)
stack = [ ] while True : com = input("Enter ( Push or Pop ) : ") if com == "push" or com == "Push" : num = int(input("Enter a number : ")) stack.insert(0,num) elif len(stack) == 0 : print("Underflow") elif com == "pop" or com == "Pop" : stack.pop(0) yes = input ("Enter ( Yes or no ) : ") if yes == "No" or yes == "no": print("Thank you !!!!") break
Q.9. The Doc_name Column of a table Hospital is given below: ( 3 marks)
Doc_name |
Avinash |
Hariharan |
Vinayak |
Deepak |
Sanjeev |
Based on the information, find the output of the following queries:
(i) SELECT doc_name FROM HOSPITAL WHERE Doc_name like “%v”;
(ii) SELECT dcc_name FROM HOSPITAL WHERE doc_name like “%e%”;
Answer:
a)
Doc_name |
Sanjeev |
(b)
Doc_name |
Deepak |
Sanjeev |
Q.10.What happens behind scenes when you send an email, before it reaches its destination? ( 3 marks)
Answer:
(i) You compose and send an email from your email client. Your email has recipient’s email address along email message.
(ii) Now your email client connects to Outgoing SMTP server and hands over email message in required format.
(iii) Outgoing SMTP first validates sender details and if valid processes message for sending and places it in Outgoing queue.
(iv) Next DNS look up takes place. SMTP server based on domain details in recipient address, looks up DNS server of domain and retrieves Recipient server information (such as MX records) of recipient domain.
(v) Then SMTP server connects with Recipient email server and sends email through SMTP protocol.
(vi) Recipient server in turn validates recipient account and delivers email to users mail account.
(vii) user logs into own email account and views received email using email client that will use POP3/IMAP protocols.
Q.11. Briefly discuss the role of following devices in the context of networking?
(i)Router ( 1 mark)
Answer:
Device that works like a bridge but can handle different protocols.
(ii)Bridge ( 2 mark)
Answer:
Device that links two networks together.
(iii)Gateway ( 1 mark)
Answer:
Device that connects dissimilar networks.
Q.12. a). What is the purpose of DROP TABLE command in MySql? How is it different from DELETE Command? ( 2 marks)
Answer:
Delete removes the rows, the drop is used to remove the tables and DB. delete – removes row from the table – where clause can be used to delete specific rows.
b)Write a query that sorts the data of table student on the basis of Project-Group (in ascending order), section (in descending order), Marks (in descending order). ( 2 marks)
Answer :
SELECT * FROM STUDENT ORDER BY PROJECT-GROUP ASC, SECTION DESC , MARKS DESC;
Q.13.Differentiate between DDL and DML commands.(4marks)
Answer:
DDL:-
1 . DDL is Data Definition Language
2 . Used to define data structure
3 . Used to define database structure or schema
4 . It uses commands are: CREATE, ALTER, DROP, TRUNCATE, RENAME
5 . Works on whole table
6 . Not have a where clause to filter
7 . The changes done by DDL commands cannot be rolled back
8 . Example — Drop table student
DML:-
1 . Data Manipulation Language
2 . Used to manipulate the existing databases.
3 . Used for managing data within schema objects
4 . The commands are: SELECT, INSERT, DELETE, UPDATE, MERGE, CALL
5 . Works on one or more rows
6. Where clause to filter records
7 . The changes can be rolled back
8 . Further classified as procedural and non procedural
9 . Example — Select * from student
Thankyou for reading Practice Test Computer Science Class 12 Term 2 Exam. Below links contains valuable data for Board 12 class-
Python Programs for CBSE Practical File Class 11 and 12
Computer Science with Python Class 12 Sumita Arora Solutions
This site contains model paper, sample and practice paper for class 12 term 2 descriptive writing. also include MCQ for term -1 and solved practical file and practice python questions.