Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

International Indian School-Dammam

Model Examination 2020-21


Computer Science (083)

Maximum Marks: 70 Time Allowed: 3 hours

General Instructions:
1. This question paper contains two parts A and B. Each part is compulsory.
2. Both Part A and Part B have choices.
3. Part-A has 2 sections:
a. Section – I is short answer questions, to be answered in one word or one line.
b. Section – II has two case studies questions. Each case study has 4 case-based sub-
parts. An examinee is to attempt any 4 out of the 5 subparts.
4. Part - B is Descriptive Paper.
5. Part- B has three sections
a. Section-I is short answer questions of 2 marks each in which two question have
internal options.
b. Section-II is long answer questions of 3 marks each in which two questions have internal
options.
c. Section-III is very long answer questions of 5 marks each in which one question has
internal option.
6. All programming questions are to be answered using Python Language only

Question Part-A Marks


No. allocated
Section-I
Select the most appropriate option out of the options given for each
question. Attempt any 15 questions from question no 1 to 21.

1 1
How many types of strings are supported in python?

2 The device that can operate in place of a hub is a : 1


a)Bridge b) Switch c) Router d) Gateway

3 A _____ governs the type of operations (e.g. read/write/append) possible in 1


the opened file.

4 Which of the following is an invalid variable ? 1


a) my_day_2 b) 2nd_day c) day_2 d) _2

Page 1 of 11
5 What will be the output of the following code? 1
tuple_a=’a’,’b’
tuple_b=(‘a’,’b’)
print(tuple_a==tuple_b)
a) 0
b) 1
c) False
d) True
6 Given the lists L=[10,12,14,20,22,24,30,32,34] , write the output of 1
print(L[0:10:2])

7 1
What will be the output after the following code is executed ?
>>>str=”hello”
>>>str[ : 2 ]
>>>

8 Identify the type of following literals 1


a) True b) ‘True’ c) 23789 d) 23.789

9 Write a statement in Python to declare a dictionary whose keys are name, 1


salary, age and values are John , 10000, 24 respectively

10 Classify the following as DDL and DML command 1


ALTER, INSERT, CREATE, SELECT

11 In SQL, name the clause that is used to select values that match any value 1
in a list of specified values.

12 In SQL, what is the use of % and _ characters ? 1

13 What is the use of count(distinct sal) function in SQL ? 1

14 1
Define the use of Telnet in the field of networking

15 Name The transmission media best suitable for fastest communication in LAN 1

16 What data type is the object below ? 1


L = 1, 23 , ‘hello’ ,1

Page 2 of 11
a.) list b. )dictionary c.) array d. ) tuple
17 If the following code is executed, what will be the output of the following 1
code?
Msg=”Model Examination 2021”
print(Msg[6:10],Msg[-6:-10])

18 How would you view the structure of a table in SQL ? 1

19 Define Packet switching? 1

20 When a field of table is a primary key of other table, it is called a 1

a) Unique key
b) Foreign key
c) Candidate key
d) Alternate key

21 1
What is meant by Bandwidth ? Give its units

Section-II
Both the Case study based questions are compulsory. Attempt any 4
sub parts from each question. Each question carries 1 mark

22 An Educational Institution, edtech is considering to maintain their


database using SQL to store the data. As a database administer, John
has decided that
 Name of the database - edtechDB
 Name of the table - studentTb
 The attributes of studentTb are as follows:
StdntId - numeric
StdntName – text of size 30

StdntDOB - date type


AnnualFee – numeric

Page 3 of 11
Table : studentTb
StdntId StdntName StdntDOB AnnualFee
1002 Sameer 2005-01-06 6000
1003 Bharat 2006-02-07 5000
1005 Alen 2005-11-10 4000
1007 Meera 2004-12-12 7000
1004 John 2007-01-09 4500
1006 Kamal 2006-09-20 6000
1008 Rahim 2004-10-25 5000
(a) Identify the attribute best suitable to be declared as a primary key, 1
(b) Write the degree and cardinality of the table studentTb. 1

(c) Insert the following data into the attributes StdntId , StdntName 1
StdntDOB and AnnualFee respectively in the given table studentTb.
StdntId = 2000, StdntName = Saira, StdntDOB = 2009-12-12 and
AnnualFee= 4500
1
(d) John wants to open database. write the command for it

(e) Now John writes the following SQL command.Based on the given 1
records in studentTb above ,what is the query result?

Select count(*) , count(distinct AnnualFee) from studentTb

23 Sahil of class 12 is writing a program to create a CSV file “Product.csv”


which will contain product name and price for some entries. He has written
the following code. As a programmer, help him to successfully execute the
given task.

import # Line 1

def writeCsvFile(ProductName,Price): # to write / add data into the


CSV file
f=open(' _________,’a’)

Page 4 of 11
newFileWriter = csv.writer(f)
newFileWriter.writerow([ProductName,Price])
f.close()

#csv file reading code


def readCsvFile(): # to read data from CSV file
with open(' Product.csv','r') as newFile:
newFileReader = csv. (newFile) # Line 3
for row in newFileReader:
print (row[0],row[1])
newFile. # Line 4

writeCsvFile(“Laptop Dell”,”5000”)
writeCsvFile (“Macbook”,”8000”)
writeCsvFile(“Mic.Notebook”,”4000”)
readCsvFile() #Line 5

(a) Name the module he should import in Line 1. 1

(b) Fill in the blank in Line 2 to open the file to write/add data into the file 1
(c) Fill in the blank in Line 3 to read the data from a csv file. 1
(d) Fill in the blank in Line 4 to close the file. 1
(e) Write the output he will obtain while executing Line 5. 1
Part – B

Section-I
24 Evaluate the following expressions: 2
a) 3**2**2 + 2**3// 5 – 7*5/2
b) 5<10 and 10<8 or not 3<18

25 Differentiate between HTML and XML 2


OR
Differentiate between Web server and web browser. Write any two popular
web browsers.
26 Expand the following terms: 2
a. WLL b. TCP/IP c. HTTP d. GPRS

Page 5 of 11
27 Differentiate between Global variable and local variable with a suitable 2
example for each.
OR
Explain the use of default parameter in a function with the help of a
suitable example.

28 Rewrite the following code in Python after removing all syntax 2


error(s). Underline each correction done in the code.
def DispTot(Number)
sum=0
for x in range (1, Number+1):
sum=+x
return Sum
s1=DispTot[3]
print(s1)

29 What possible outputs(s) are not expected to be displayed on screen at the 2


time of execution of the program from the following code? Also specify the
maximum and minimum values that can be assigned to the variable Start

import random
N=[20,30,40,50,60,70];
Start =random.randint(1,3)
End =random.randint(2,4)
for a in range(Start, End +1):
print ( N[a],end=”@“)

(i) 30@40@50@ (ii) 10@40@70@ (iii) 40@50@70@


(iv) 50@60@70@

30 What is the difference between WHERE and HAVING clause of SQL SELECT 2
statement ?Give example.

Page 6 of 11
31 Differentiate between fetchmany() and fetchall() methods with suitable 2
examples for each.
32 2
What do you understand by Candidate Keys in a table? Give a suitable
example of Candidate Keys from a table containing some meaningful data.
33 Find and write the output of the following Python code: 2

Str1 = "EXAM2020"
Str2 = " "
I=0
while I<len(Str1):
if Str1[I]>="A" and Str1[I]<="M":
Str2=Str2+Str1[I+1]
elif Str1[I]>="0" and Str1[I]<="9":
Str2=Str2+ (Str1[I-1])
else:
Str2=Str2+"*"
I=I+1
print(Str2)

Section- II

34 Write definition of a Method COUNTNOW(PLACES) to find and display those 3


place names, in which there are more than 5 characters.
For example:
If the list PLACES contains
["DELHI","LONDON","PARIS","NEW YORK","DUBAI"]

The following should get displayed


LONDON
NEW YORK

35 Write a python method countstuff() that will count the number of 3


alphabets, digits and special characters in the text file stuff.txt

Page 7 of 11
OR

Write a function LetterCount() in Python, which should read each character of a


text file Notes.TXT, should count and display the occurrence of alphabets i and
y (including small and capital cases).

Example:
If the file content is as follows:
Living a life you can be proud of
I do my best and all of you are doing your best

The LetterCount() function should display the

output as:

i or I : 5 y or Y : 4

36 Write the outputs of the SQL queries (i) to (iii) based on the relations SAMS 3
and VENDOR given below:
Table: SAMS

ICode IName Price Colour VCode

S001 Refrigerator 20000 White P01

S002 Mobile Phone 45000 Black P02

S003 LCD 60000 Black P03

S004 Washing Machine 12500 Blue P01

S005 Air Conditioner 16000 White P05

Page 8 of 11
Table : VENDOR
VCode VName
P01 Satish
P02 Manoj
P03 Subodh
P04 Jacob

i. SELECT Max(Price) ,Sum(Price) FROM


SAMS where IName LIKE “%r”
ii. SELECT Colour, count(*) FROM SAMS
GROUP BY Colour;
iii. SELECT S.IName, V.VName
FROM SAMS S, VENDOR V WHERE
S.VCode=V.VCode
AND S.Colour=”White”

37 Write a function in Python PUSH(Arr), where Arr is a list of numbers. From 3


this list if the number is odd then multiply with two, if the number is even find
its square and push into stack. Display the stack if it has at least one element,
otherwise display appropriate error message.

OR
Write a function in Python POP(Arr), where Arr is a stack implemented by a
list of numbers. The function returns the value deleted from the stack.

Section-III
38 Global University is setting up its academic blocks at Delhi and is 5
planning to set up a network. The University has 3 academic blocks
and one Human Resource Center as shown in the diagram below:

Center to Center distances between various blocks/center is as follows:

Page 9 of 11
Law Block to business Block 40m
Law block to Technology Block 80m
Law Block to HR center 105m
Business Block to technology
30m
Block
Business Block to HR Center 35m
Technology block to HR center 15m
Number of computers in each of the blocks/Center is as follows:
Law Block 15
Technology Block 40
HR center 115
Business Block 25

a) Which of the following devices will be suggested by you to


connect each computer in each of the buildings
Gateway , Switch , Modem
b) Suggest an ideal layout for connecting these blocks/centers for a
wired connectivity.
c) The University is planning to start a new branch in another
country. Which type of network out of LAN, MAN, or WAN
will be formed? Justify your answer
d) What will be the most appropriate block, where university
should place to install their server ?
e) Is a Repeater needed in the network? Justify

39 Write SQL commands for the following queries (i) to (v) based on the 5
relations Employee and Department given below:

Table : Employee
ENO ENAME SALARY ZONE AGE GRADE DEPT

E1 Mona 70000 East 40 A 10

E2 Muktar 71000 West 45 B 20

Page 10 of 11
E3 Nalini 60000 East 26 A 10
E4 Sanaj 65000 South 36 A 20
E5 Surya 58000 North 30 B 30

Table : Department
DEPT DNAME
10 Computers
20 Economics
30 English

i. To display employee number, name and grade of


all employees whose age is between 30 and 40
ii. To list the details of all employees who are in East or South
Zone in descending order of salary
iii. To list number of employees for each grade.
iv. To display Employee name, Age and corresponding
department name.
v. To display Employee name, salary ,zone and income tax
(Note : Income tax to be calculated as 30% of salary ) of all
the employees with appropriate column headings.
40 A binary file “Stock.dat” has structure [ItemNo, Item_Name, 5
Company_Name, Cost_Price,Selling_Price].
i. Write a user defined function CreateStockFile() to input
data for a record and add to Stock.dat .
ii. Write a function CountRow(Company_Name) in Python
which accepts the Company_Name as parameter and count
and return number of Items by the given Company that are
stored in the binary file “Stock.dat”

OR
A binary file “CUSTOMER.DAT” has structure ( CustNo, CustName,
Balance). Write a function Disprec() in Python that would read contents of
the file “CUSTOMER.DAT” and display the details of those customers whose
Balance is in the range of 400000 and 500000. Also display number of
customers having balance in the range of 400000 and 500000

Page 11 of 11

You might also like