CS Sample Paper-1 QP
CS Sample Paper-1 QP
CS Sample Paper-1 QP
2.
(a) NULL (b) PRIMARY KEY
(c) CHECK (d) NOT NULL
6.
9.
(a) unique key (b) prime attribute
(c) index key (d) primary key
10. a = 1.0
b = 1.0
a is b # Line 1
Output of Line 1 will be
(a) False (b) True
(c) 1.0 (d) 0.0
11. Which of the following is a correct syntax to add a column in SQL command?
(a) ALTER TABLE table_name ADD column_name data_type;
(b) ALTER TABLE ADD column_name data_type;
(c) ALTER table_name ADD column_name data_type;
(d) None of the above
13. a = 6
b = 5.5
sum = a+b
print(sum)
print(type (sum))
(a) 11.5 (b) 10.5
16.
(a) writelines() (b) write()
(c) writerow() (d) writer()
Directions : (Q.Nos.-17 and 18) are Assertion and Reason based Questions.
17.
Reason (R) id( ) and type( ) are built-in functions in Python.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true.
19. Riya was asked to accept a list of even numbers ,but she did not put the relevant condition while accepting the list
20.
or
25.
or
Identify any two DML commands from the following and also explain.
ALTER , INSERT , UPDATE , DROP , CREATE
TABLE: STREAM
STRCDE STRNAME
1 SCIENCE+COMP
2 SCIENCE+ BIO
3 SCIENCE+ECO
4 COMMERCE+MATHS
(b) Write the output for SQL queries (i) to (iv), which are based on the table ITEMS.
TABLE: ITEMS
Code IName Qty Price Company TCode
1001 DIGITAL PAD 12i 120 11000 XENITA T01
1006 LED SCREEN 40 70 38000 SANTORA T02
1004 CAR GPS SYSTEM 50 2150 GEOKNOW T01
1003 DIGITAL CAMERA 12X 160 8000 DIGICLICK T02
27.
display the occurrence of alphabets E and U (including small cases e and u too).
step solutions for all your study, practice and assessment need for various competitive and recruitment examinations and
school segment. We have been working tirelessly for over a decade to make sure that you have best in class study
resources because you deserve SUCCESS AND NOTHING LESS...
Output should be
Longest word : examinations
28. (a) Consider the following tables GARMENT and FABRIC. Write SQL commands for the statements (i) to (iv).
TABLE: GARMENT
GCODE DESCRI-PTION PRICE FCODE READY-DATE
10023 PENCIL SKIRT 1150 F03 19-DEC-08
10001 FORMAL SHIRT 1250 F01 12-JAN-08
10012 INFORMAL SHIRT 1550 F02 06-JUN-08
10024 BABY TOP 750 F03 07-APR-07
10090 TULIP SKIRT 850 F02 31-MAR-07
10019 EVENING GOWN 850 F03 06-JUN-08
10009 INFORMAL PANT 1500 F02 20-OCT-08
10007 FORMAL PANT 1350 F01 09-MAR-08
10020 FROCK 850 F04 09-SEP-07
10089 SLACKS 750 F03 20-OCT-08
TABLE: FABRIC
FCODE TYPE
F04 POLYSTER
F02 COTTON
F03 SILK
F01 TERELENE
(i) To display GCODE and DESCRIPTION of each GARMENT in descending order of GCODE.
(ii) To display the details of all the GARMENTs, which have READYDATE in between 08-DEC-07 and 16-
JUN-08 (inclusive of both the dates).
(iii) To display the average PRICE of all the GARMENTs. Which are made up of FABRIC with FCODE as F03.
(iv) To display FABRIC wise highest and lowest price of GARMENTs from GARMENT table.
(Display FCODE of each GARMENT alongwith highest and lowest price.)
(b) Write a command to remove all the records of a table “Shipping”.
29.
displayed element is the twice of the original element (element *2) of the List x in the following manner:Example :
If List x contains 7 integers is as follows:
x [0] x [1] x [2] x [3] x [4] x [5] x [6]
4 8 7 5 6 2 10
After executing the function, the array content should be displayed as follows:
20 4 12 10 14 16 8
30. Julie has created a dictionary containing names and marks as key value pairs of 6 students. Write a program, with
(a) Push the keys (name of the student) of the dictionary into a stack, where the corresponding value (marks) is
greater than 75.
(b) Pop and display the content of the stack.
For example If the sample content of the dictionary is as follows
R={“OM”:76, “JAI”:45, “BOB”:89, “ALI”:65, “ANU”:90, “TOM”:82}
The output from the program should be
TOM ANU BOB OM
or
31. Red Pandas Infosystems has its 4 blocks of buildings. The number of computers and distances between them is
given below :
Building Number of Computers
HR 15
ADMIN 100
SYSTEM 25
PERS 30
Building Distance
HR -Admin 10 m
HR- System 50 m
HR- Pers 750 m
Admin- System 300 m
Admin- Pers 20 m
System-Pers 250 m
Consider:
host : localhost
UserName : root
Password : system
Database : Mobile
33.
Write a program using two functions :
(b) readCustomer( ): To read the details of the customers and display them.
or
35. Below is a program to delete the line having word (passed as argument). Answer the questions that follow to executethe
program successfully.
import ......
“......”)
while True:
if not line:
break
else :
if word in line :
......
else :
print(line)