Computer Science (083) - Only 1 Set
Computer Science (083) - Only 1 Set
General Instructions:
Section A
(1 mark)
1 State true or false: [1]
The expression 2**2**3 is evaluated as: (2**2)**3.
3 Which method returns the next row from the result set as tuple? [1]
a) fetchone()
b) rowcount
c) fetchall()
d) fetchmany()
4 x=10 [1]
def demo(x):
global x
x+=5
print(x)
demo(x)
What will be the output of the above program?
a) Error
b) 10
c) 15
d) 5
5 What is a Firewall in Computer Network? [1]
a) An operating System of Computer Network.
b) A web browsing Software.
c) The physical boundary of Network.
d) A system designed to prevent unauthorized access.
6 In file handling, what does these terms means "r and a"? [1]
a) read, append
b) read, all
c) None of these
d) read, always
7 l1 = [ 1,2,3,4,5] [1]
l1.append([[ 5,6],[ 7,8],[ 9,10]])
What will be the final length of l1?
a) 10
b) 6
c) 8
d) Error
8 With SQL, how do you select all the records from a table named "Students" [1]
where the value of the column "FirstName" ends with an "a"?
a) SELECT * FROM Students WHERE FirstName LIKE ’%a’
b) SELECT * FROM Students WHERE FirstName = ’%a%’
c) SELECT * FROM Students WHERE FirstName LIKE ’a%’
d) SELECT * FROM Students WHERE FirstName = ’a’
c) file = open("c:\\folder1\\notes.txt")
11 The data structure required to check whether an expression contains balanced [1]
parenthesis is ________.
a) Queue
b) Array
c) Stack
d) Tree
12 Given a function that does not return any value, what value is thrown by default [1]
when executed in shell?
a) void
b) None
c) bool
d) int
17 Assertion (A): Python converts the program into byte code, and any platform [1]
can use that byte code.
Reason (R): Python supports object - oriented language.
a) Both A and R are true and R is the correct explanation of A.
b) Both A and R are true but R is not the correct explanation of A.
c) A is true but R is false.
d) A is false but R is true.
18 Assertion (A): CSV stands for comma - separated values , which is defined as [1]
a simple file format that uses specific structuring to arrange tabular data.
Reason (R): The csv module is used to handle the CSV files to read/write and
get data from specified columns.
a) Both A and R are true and R is the correct explanation of A.
b) Both A and R are true but R is not the correct explanation of A.
c) A is true but R is false.
d) A is false but R is true.
Section B
(2 marks)
19 Answer the following questions: [2]
a)What is a Modem? State its functionality.
b)Write one characteristic each for 2G and 3G mobile technologies.
OR
a) Explain any two switching techniques used in networking.
20 Rewrite the program after removing the errors and underline the corrections [2]
made.
Jean wanted to write a program to find the unique names in a list but the
following program does not do so.
def unique(Names_list):
new_list=[]
for names in Names_list
if new_list not in names.title() :
new_list.extend(names.title())
return new_list
21 In the below given code fragments, indicate the data type of each bold part by [2]
choosing the correct type of data from the following type.
i) L = inputline.split( )
while L != ( ) :
print(L)
L = L[ 1 :]
25 Write a function in Python that counts the number of "Me" or “My" words [2]
present in a text file "STORY.TXT".
If the “STORY.TXT" contents are as follows:
What would be the output produced if the files are read and printed with the
following code?
obj1= open(“p1.txt”, “r”)
obj2=open(“p2.txt”, “r”)
print(obj1.read())
print(obj2.read())
obj1.close()
obj2.close()
Section C
(3 marks)
26 Consider the following tables. [3]
TABLE: SENDER
TABLE : RECEPIENT
27 Write the output for the queries given below, which are based on the tables. [3]
Table : TRAINER
Table : COURSE
a) Give the output for the following questions:
i) SELECT T.TNAME, C.CNAME FROM TRAINER T, COURSE C WHERE
T.TID = C.TID AND STARTDATE >”2018-08-01”;
ii) SELECT COUNT(*) , CITY FROM TRAINER GROUP BY CITY ORDER BY
CITY;
iii) SELECT SUM(FEES), TID FROM COURSE GROUP BY TID;
iv) SELECT AVG(SALARY) ,CITY FROM TRAINER GROUP BY CITY;
28 Write the Python code to read a text file data.txt which contains lines of text. [3]
Each line of text constitutes of names of persons residing in each colony. The
program should display the lines which has the name “Jacob” in it.
OR
Write the Python code to read a text file List.txt which contains lines of text.
Each line of text constitutes of names of companies in each region.
The names of companies are separated by “;”
For e.g.
ABC PVTLTD; FIONA PUBLISHERS ; DHRAM & SONS PVTLTD ;
JERRY PRINTERS ; HARIOM PVTLTD. ;
The program should find and display the number of PvtLtd companies . The
names of Pvt Ltd companies will end with the word PVTLtd.
i) State the cardinality and degree of relation of the above table if two more
rows were added and 3 columns were added.
ii) State the candidate and primary keys of the above table.
iii) Write the statement to increase the price by 10% of Green Mango and Aam
Panna.
30 Write a program to implement a stack for these book details (book no., book [3]
name). That is, now each item node of the stack contains two types of
information - a book no. and its name of those books that has book nos
greater than 2000. Implement Push( List of Books) and pop() with display
operations.
Section D
(4 marks)
31 Consider the following data is store in a CSV file:- [4]
Write the program code to read the above CSV file Item.csv and display the
details of the Item that has the maximum rate.
32 Consider the following data that is stored in a binary file “Student.dat” which [4]
contains data in the following format.
{ (102, “Neena”) : “Computer Science”, (320, “Leena”): “Physics”, (430,
“Teena”):”Chemistry”………}
Write the Python code to read the above file and display the students having
the subject SUB passed as parameters to a function display() .
Section E
(5 marks)
33 Great Studies University is setting up its Academic schools at Sunder Nagar [5]
and planning to set up a network. The university has 3 academic schools and
one administration centre as shown in the diagram below:
34 i) State the difference between seek() and tell() giving an example of each. [5]
ii) Dr. Ramesh stores the details of his patients in a binary file “Patient.dat” as
following:-
{“Name “: ………., “Patient_Id”:………, “ Prescribed Medicine”: [Medicine1,
Medicine 2….] }
{“Name “: ………., “Patient_Id”:………, “ Prescribed Medicine”: [Medicine1,
Medicine 2….] }
etc.
Dr. Ramesh would like to know the names of patients that he has prescribed
the medicine “Amoxyciline”.
Write a program code in Python to read the above file and display the names of
patients to whom “Amoxyciline” was prescribed.
OR
i) Suppose a text file “Report.txt” has the following content:
It is festival time
People are enjoying the festivities
ii) Dr. Ramesh stores the details of his patients in a binary file as following:-
{“Name “: ………., “Patient_Id”:………, “ Prescribed Medicine”: [Medicine1,
Medicine 2….] }
{“Name “: ………., “Patient_Id”:………, “ Prescribed Medicine”: [Medicine1,
Medicine 2….] }
etc.
Write a program code in Python to read the above file and display the names of
patients who have been prescribed more than 3 medicines.
35 i) State the difference between ALTER and UPDATE command with an [5]
example
ii)The school has stored the details of the faculty in the database “SCHOOL” in
a table called Faculty.
The data in the faculty is as given as below:-
Username - root
Password - tiger
Host - localhost
Write a user defined function Connect() in Python to read the content of the
above file and display the names and qualification of those faculty members
who are teaching the subject SUB which is passed as parameter to the function
Connect().
OR
a) What is the difference between equi join and natural join.
b) The code given below updates the following record in the table :
i) The table exists in a MYSQL database named Inventory
ii) The table is ITEMS
iii) The fields in ITEMS are: Itcode, Itname, Quantity, Price