Professional Documents
Culture Documents
12 CS Preboard Set-I QP 2023-24
12 CS Preboard Set-I QP 2023-24
12 CS Preboard Set-I QP 2023-24
General Instructions:
Please check this question paper contains 35 questions.
The paper is divided into 5 Sections-A, B, C, D and E.
Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
All programming questions are to be answered using Python Language only.
_______________________________________________________________________________
SECTION-A
2. In a table in MYSQL database, an attribute A of data type varchar(20) has the value “Rahul”. The [1]
attribute B of data type char(30) has value “Akash”. How many characters are occupied by attribute A and
attribute B?
(a) 20,5 (b) 5,30 (c)5,5 (d)20,30
3. What will the output for the following expression be evaluated in Python? [1]
print ( round (100.0 / 4 + (3 + 2.55) , 1 ) )
(a) 30.0 (b) 30.55 (c) 30.6 (d) 31
5. Which function is used to display the total number of records from a table in a database? [1]
(a) total() (b) total(*) (c) return(*) (d) count(*)
7. Which of the following statement(s) would give an error after executing the following code? [1]
D={'rno':32,'name':'Ms Archana','subject':['hindi','english','cs'],'marks':(85,75,89)} #S1
print(D) #S2
D['subject'][2]='IP' #S3
D['marks'][2]=80 #S4
print(D) #S5
(a) S1 (b) S3 (c) S4 (d) S3 and S4
9. Which of the following will be correct output if the given expression is evaluated? [1]
not ((True and False) or True)
(a) True (b) False (c) NONE (d) NULL
10. Which switching technique follows the store and forward mechanism? [1]
(a)Circuit switching (b) Message switching (c) Packet switching (d) All of these
14. In order to open a connection with MySQL database from within Python using mysql.connector [1]
package, __________ function is used.
(a) open() (b) connect() (c) database() (d) connectdb()
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True
SECTION-B
20. Vivek has written a code to input a number and check whether it is even or odd number. His code is having
errors. Rewrite the correct code after removing the logical and syntactical errors and underline the correction
made. [2]
Def checkNumber(N):
status = N%2
return
num=int(input(“Enter a number to check :))
k=checkNumber(num)
if k = 0:
print(“This is EVEN number”)
else:
print(“This is ODD number”)
21. Write a function lenFOURword(L), where L is the list of elements (list of words) passed as argument to the
function. The function returns another list named ‘indexList’ that stores the indices of all four lettered word of L.
For example:
If L contains [“DINESH”, “RAMESH”, “AMAN”, “SURESH”, “KARN”] [2]
The indexList will have [2, 4]
23. A list named “studentAge” stores age of students of a class. Write the Python command to import the required
module and (using built-in function) to display the most common age value from the given list. [2]
24. Zack is working in a database named SPORT, in which he has created a table named “Sports” containing
columns SportId, SportName, no_of_players, and category. [2]
After creating the table, he realized that the attribute, category has to be deleted from the table and a new attribute
TypeSport of data type string has to be added. This attribute TypeSport cannot be left blank. Help Zack write the
commands to complete both the tasks.
SECTION-C
(i) Select BRAND_NAME, FLAVOUR from CHIPS where PRICE <> 10;
(ii) Select * from CHIPS where FLAVOUR=”TOMATO” and PRICE > 20;
(iii) Select BRAND_NAME from CHIPS where PRICE> 15 and QUANTITY < 15;
(iv) Select count( distinct (BRAND_NAME)) from CHIPS;
(v) Select PRICE , PRICE *1.5 from CHIPS where FLAVOUR = “PUDINA”;
(vi) Select distinct (BRAND_NAME) from CHIPS order by BRAND_NAME desc;
28. Write a function countINDIA() which read a text file ‘myfile.txt’ and print the frequency of the words ‘India’
in it (ignoring case of the word). [3]
Example: If the file content is as follows:
INDIA is my country. I live in India. India has many states.
The countIndia() function should display the output as:
Frequency of India is 3
29(a).Consider the table ‘PERSONS’ is given below. Write commands in SQL for (i) to(iv). [2]
Pid SurName FirstName Gender City PinCode BasicSalary
1 Sharma Geeta F Udhamwara 182141 50000
2 Singh Surinder M Kupwara Nagar 193222 75000
3 Jacob Peter M Bhawani 185155 45000
4 Alvis Thomas M Ahmed Nagar 380025 50000
5 Mohan Garima M Nagar Coolangatta 390026 33000
6 Azmi Simi F New Delhi 110021 40000
7 Kaur Manpreet F Udhamwara 182141 42000
(i) Display the Sur Names, First Names and Cities of people residing in Udhamwara city.
(ii) Display the Person Ids (PID), cities and Pin codes of persons in descending order of Pincodes.
(iii) Display the First Names and cities of all the females getting Basic Salaries above 40000.
(iv) Display First Names and Basic Salaries of all the persons whose First Names starts with “G”.
Write the following user defined functions to perform given operations on the stack named ‘Stud’:
(i) pushElement() - To Push an object containing name and mobile number of students who belong to class XII
and section ‘A’ to the stack.
(ii) popElement() - To Pop the objects from the stack and display them. Also, display “Stack Empty” when there
are no elements in the stack.
For example:
If the lists of students details are:
[“Rajveer”, “99999999999”,”XI”, “B”]
[“Swatantra”, “8888888888”,”XII”, “A”]
[“Sajal”,”77777777777”,”VIII”,”A”]
[“Yash”, “1010101010”,”XII”,”A”]
SECTION-D
31. Consider the following tables BOOKS and ISSUED in a database named “LIBRARY”. Write SQL commands
for the statements (i) to (iv). [4]
Table: BOOKS
BID BNAME AUNAME PRICE TYPE QTY
COMP 11 LET US C YASHWANT 350 COMPUTER 15
GEOG33 INDIA MAP RANJEET P 150 GEOGRAPHY 20
HIST66 HISTORY R BALA 210 HISTORY 25
COMP12 MY FIRST C VINOD DUA 330 COMPUTER 18
LITR88 MY DREAMS ARVIND AD 470 NOBEL 24
Table: ISSUED
BID QTY_ISSUED
HIST66 10
COMP1 15
LITR88 15
(i) Display book name and author name and price of computer type books.
(ii) To increase the price of all history books by Rs 50.
(iii) Show the details of all books in ascending order of their prices.
(iv) To display book id, book name and quantity issued for all books which have been issued.
otherwise it wont be able to understand which tables column ur asking for.... select books.bid where books.bid
whenever joining is required
32. Shreya is a Python programmer working in a Company. For the Annual Event, he has created a csv file named
Product.csv, to store the information of product. The structure of Product.csv is: [4]
For efficiently maintaining data of the event, Shreya wants to write the following user defined functions:
Accept() – to accept a record from the user and add it to the file Product.csv. The column headings should also be
added on top of the csv file.
Increase() – to increase the price of those product by 10% which have quantity more than 100.
SECTION-E
33.(a) Write a Program in Python that defines and calls the following user defined functions: [4]
(i) ADD() – To accept and add data of a teacher to a Binary file ‘teacher.dat’. Each record consists
of a list with field elements as tid, name and mobile to store teacher id, teacher name and teacher
mobile number respectively.
(ii) COUNTRECORD() – To count the number of records present in the Binary file named ‘teacher.dat’.
(b)What is the difference between Binary File and Text file in File handling? [1]
34.(a) What is the difference between drop and delete command in MySQL? Explain with example. [1]
(b) Rahul has created a table named Employee in MYSQL database, EMP: [4]
Eid(Employee ID )- integer
name(Name) - string
DOB (Date of birth) – Date
Salary – float
Rahul, now wants to insert 5 records into table Employee and display those records of Employee whose Salary is
more than 50000.
From To Distance
ADMIN ENGINEERING 55 m
ADMIN BUSINESS 90 m
ADMIN MEDIA 50 m
ENGINEERING BUSINESS 55 m
ENGINEERING MEDIA 50 m
BUSINESS MEDIA 45 m
DELHI HEAD CHENNAI 2175 km
OFFICE CAMPUS
ADMIN 110
ENGINEERING 75
BUSINESS 40
MEDIA 12
DELHI HEAD 20
(a) Suggest and draw the cable layout to efficiently connect various blocks of buildings within the CHENNAI
campus for connecting the digital devices. [1]
(b) Which network device will be used to connect computers in each block to form a local area network? [1]
(c) Which block, in Chennai Campus should be made the server? Justify your answer. [1]
(d) Which fast and very effective wireless transmission medium should preferably be used to connect the head
office at DELHI with the campus in CHENNAI? [1]
(e) Is there a requirement of a repeater in the given cable layout? Why/ Why not? [1]