Professional Documents
Culture Documents
NCS - Computer Science Practical-Sample Paper-29-12-2023
NCS - Computer Science Practical-Sample Paper-29-12-2023
Options:
a. PYTHON-IS-Fun b)PYTHON-is-Fun
c) Python-is-fun d)PYTHON-Is -Fun
[1]
5 In MYSQL database, if a table, Alpha has degree 4 and cardinality 3, and another 1
table, Beta has degree 3 and cardinality 5, what will be the degree and cardinality of
the Cartesian product of Alpha and Beta?
a. 5,3 b. 7,15 c. 3,5 d. 15,8
6 Riya wants to send files from her computer to her friend who lives in U.S.A . and Riya 1
lives in Uttar Pradesh Which type of networkwill be formed in this case?
a. PAN b. LAN c. MAN d. WAN
7 Which of the following will delete key-value pair for key = “Red” from adictionary D1? 1
i) geeks@ ii)geeks@for
ii) esfrgek iv)esfrge
9 Which of the following statement(s) would give an error during execution of 1
the following code?
tup = (20,30,40,50,80,79)
print(tup) #Statement 1
print(tup[3]+50) #Statement 2
print(max(tup)) #Statement 3
tup[4]=80 #Statement 4
Options:
a)Statement 1 b)Statement 2 c) Statement 3 d)Statement 4
10 What possible outputs(s) will be obtained when the following code isexecuted? 1
[2]
11 Fill in the blank: 1
The modem at the receiver’s computer end acts as a .
a. Model b)Modulator c)Demodulator d)convertor
12 Consider the code given below: 1
Which of the following statements should be given in the blank for#Missing Statement,
if the output produced is 110?
Options:
a)global b)global b=100 c)global b
d)global a=100
[3]
17 Assertion(A): List is an immutable data type 1
Reasoning(R): When an attempt is made to update the value of an immutable variable,
the old variable is destroyed and a new variable is
created by the same name in memory.
18 Assertion(A): Python Standard Library consists of various modules. 1
Reasoning(R): A function in a module is used to simplify the code andavoids repetition.
SECTION B
19 (i) Expand the following terms: 1+1=
a)HTTP b)FTP 2
(ii) Give one difference between XML and HTML.
OR
(i) Define the term bandwidth with respect to networks.
(ii) How is http different from https?
20 The code given below accepts a number as an argument and returns the reverse number. 2
Observe the following code carefully and rewrite it after removing all syntax and logical
errors. Underline all the corrections made.
[4]
22 Predict the output of the following code: 2
23 Write the Python statement for each of the following tasks using BUILT-IN 1+1=
functions/methods only: 2
(i) To insert an element 200 at the third position, in the list L1.
(ii) To check whether a string named,message has digits only
OR
A list named studentAge stores age of students of a class. Write thePython command
to import the required module and (using built-in function) to display the most common
age value from the given list.
24 Ms. Shalini has just created a table named “Employee” containingcolumns 2
Ename, Department and Salary.
After creating the table, she realized that she has forgotten to add a primary key column in
the table. Help her in writing an SQL command to add a primary key column EmpId of
integer type to the table Employee.
Thereafter, write the command to insert the following record in the table:
EmpId- 999
Ename- Ritika
Department: Purchase
Salary:26900
OR
Zack is working in a database named SPORT, in which he has created atable named
“Sports” containing columns SportId, SportName, no_of_players,
and category.
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.
[5]
25 Predict the output of the following code: 2
SECTION C
26 Predict the output of the Python code given below: 3
27 Consider the table CLUB given below and write the output of the SQL 1*3=
3
queries that follow.
[6]
1256 AMINA 36 FEMALE CHESS 1100 2003-
08-15
1720 MANJU 33 FEMALE KARATE 1250 2004-
04-10
2321 VIRAT 35 MALE CRICKET 1050 2005-
04-30
(i) SELECT COUNT(SPORTS) FROM CLUB;
(ii) SELECT CNAME, SPORTS FROM CLUB WHERE
DOAPP<"2006-04-30" AND CNAME LIKE "%A%";
(iii) SELECT CNAME, AGE, PAY FROM CLUB WHEREGENDER
= "MALE" AND PAY BETWEEN 900 AND
1100;
28 Write a function in Python to read a text file, Alpha.txt and displaysthose lines which 3
begin with the word ‘You’.
OR
[7]
Based on the given table, write SQL queries for the following:
(i) Increase the salary by 5% of personals whose allowance is known.
(ii) Display Name and Total Salary (sum of Salary and Allowance) of
all personals. The column heading ‘Total Salary’ should also be displayed.
(iii) Delete the record of personals who have salary greater than 20000
30 A list, NList contains following record as list elements: 3
[City, Country, distance from Delhi]
Each of these records are nested together to form a nested list. Write thefollowing user
defined functions in Python to perform the specified operations on the stack named
travel.
(i) Push_element(NList): It takes the nested list as an argument and
pushes a list object containing name of the city andcountry, which are not in
India and distance is less than 3500 kmfrom Delhi.
(ii) Pop_element(): It pops the objects from the stack and displays them. Also,
the function should display “Stack Empty” when thereare no elements in the
stack.
For example: If the nested list contains the following data:
NList=[["New York", "U.S.A.", 11734],
["Naypyidaw", "Myanmar", 3219],
["Dubai", "UAE", 2194],
["London", "England", 6693],
["Gangtok", "India", 1580],
["Columbo", "Sri Lanka", 3405]]
The stack should contain:
['Naypyidaw', 'Myanmar'],
['Dubai', 'UAE'],
['Columbo', 'Sri Lanka']The
output should be:
['Columbo','SriLanka']
['Dubai', 'UAE']
['Naypyidaw', 'Myanmar']
Stack Empty
SECTION D
31. Consider the following table Book
[8]
Book_id Subject Book_price Book_pub
B001 Computer 500 Sultan chand
B002 Chemistry 550 S.Chand
B003 Physics 450 S.Chand
B004 Maths 350 NCERT
SECTION E
[9]
33 Meticulous EduServe is an educational organization. It is planning to setup 1*5=
5
its India campus at Chennai with its head office at Delhi. The Chennai campus
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
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.
[10]
b) Which network device will be used to connect computers in each block toform a local
area network?
c) Which block, in Chennai Campus should be made the server? Justify youranswer.
d) Which fast and very effective wireless transmission medium should
preferably be used to connect the head office at DELHI with thecampus in
CHENNAI?
e) Is there a requirement of a repeater in the given cable layout? Why/
Why not?
to the file named BASKET.DAT. The function should return the total
35 (i) Define the term Domain with respect to RDBMS. Give one example 1+4=
5
to support your answer.
[11]
(ii) Kabir wants to write a program in Python to insert the following recordin the table
named Student in MYSQL database, SCHOOL:
• Username - root
• Password - tiger
• Host - localhost
The values of fields rno, name, DOB and fee has to be accepted fromthe user. Help
Kabir to write the program in Python.
OR
(i) Give one difference between alternate key and candidate key.
• Username - root
• Password - tiger
• Host – localhost
[12]
Sartaj, now wants to display the records of students whose fee is more than5000. Help
Sartaj to write the program in Python.
[13]