CS Board 19to23
CS Board 19to23
CS Board 19to23
COMPUTER SCIENCE
General Instructions :
(i) SECTION A refers to programming language C++.
(ii) SECTION B refers to programming language Python.
(iii) SECTION C is compulsory for all.
(iv) Answer either SECTION A or SECTION B.
(v) It is compulsory to mention on the page 1 in the answer-book whether you
are attempting SECTION A or SECTION B.
(vi) All questions are compulsory within each section.
(vii) Questions 2(b), 2(d), 3 and 4 have internal choices.
91 1 P.T.O.
SECTION A
[Only for candidates, who opted for C++]
1. (a) Write the names of any four fundamental data types of C++. 2
(b) Write the names of the correct header files, which must be included
in the following C++ code to compile the code successfully : 1
void main()
{
char L[]="CS 2018";
int N=strlen(L);
cout<<L[N-1];
}
(c) Rewrite the following C++ program after removing any/all
syntactical error(s). Underline each correction done in the code : 2
Note : Assume all required header files are already included in the
program.
#define Area(L,B) = L*B
structure Recta
{
int Length,Breadth;
};
void main()
{
Recta R = [10,15];
cout<<Area(Length.R,Breadth.R);
}
(d) Find and write the output of the following C++ program code : 2
Note : Assume all required header files are already included in the
program.
void Alter(char *S1, char *S2)
{
char *T;
T=S1;
S1=S2;
S2=T;
cout<<S1<<"&"<<S2<<end1;
}
void main()
{
char X[]="First", Y[]="Second";
Alter(X,Y);
cout<<X<<"*"<<Y<<end1;
}
91 2
(e) Find and write the output of the following C++ program code : 3
Note : Assume all required header files are already included in the
program.
(f) Observe the following C++ code and find the possible output(s) from
the options (i) to (iv) following it. Also, write the minimum and
maximum values that can possibly be assigned to the variable End. 2
Note :
Assume all the required header files are already being included in
the code.
The function random(N) generates any possible integer between
0 and N-1 (both values included).
void main()
{
randomize();
int A[]={10,20,30,40,50,60,70,80};
int Start = random(2) + 1;
int End = Start + random(4);
for(int I=Start; I<=End, I++)
cout<<A[I]<<"$";
}
void main()
{
Test T1(10); //Statement I
Test T2(70); //Statement II
Test T3(30, "PRACTICAL"); //Statement III
_______________; //Statement IV
}
(i) Which of the statement(s) out of (I), (II), (III), (IV) is/are
incorrect for object(s) of the class Test ? 1
91 4
(b) Observe the following C++ code and answer the questions (i) and (ii).
Note : Assume all necessary files are included.
class Point
{
int X,Y;
public:
Point(int I=10, int J=20) //Function 1
{
X = J;
Y = I;
}
void Show() //Function 2
{
cout<< " Points are " << X << " & " << Y <<endl;
}
~Point() //Function 3
{
cout<<"Points Erased"<<endl;
}
};
void main()
{
Point P(5);
P.Show();
}
OR
91 5 P.T.O.
(c) Write the definition of a class GRAPH in C++ with following
description : 4
Private Members
XUnit // integer
YUnit // integer
follows : */
Condition Type
Public Members
91 6
(d) Answer the questions (i) to (iv) based on the following : 4
class Ground
{
int Rooms;
protected:
void Put();
public:
void Get();
};
void main()
{
Top T;
}
(i) Which type of Inheritance out of the following is illustrated
in the above example ?
Single Level Inheritance, Multilevel Inheritance,
Multiple Inheritance
(ii) Write the names of all the members, which are directly
accessible by the member function Give() of class Middle.
(iii) Write the names of all the members, which are directly
accessible by the member function Out() of class Top.
(iv) Write the names of all the members, which are directly
accessible by the object T of class Top declared in the main()
function.
OR
91 7 P.T.O.
(d) Consider the following class HeadQuarter 4
class HeadQuarter
{
int Code;
char Des[20];
protected :
char Address[40];
public:
void Get(){cin>>Code;gets(Des);gets(Address);}
void Put(){cout<<Code<<Des<<Address<<endl;}
};
Write a code in C++ to protectedly derive another class FrontOffice
from the base class HeadQuarter with following members.
Data Members
Location of type character of size 10
Budget of type double
Member Functions
A constructor function to assign Budget as 100000
Assign() to allow user to enter Location and Budget
Display() to display Location and Budget
0 1 2 3 4
25 8 12 49 9
OR
91 8
(a) Write a user-defined function ReArrange(int Arr[], int N) in C++,
which should swap the contents of the first half locations of the
array Arr with the contents of the second half locations. N (which is
an even integer) represents the total number of elements in the
array Arr. 3
Example :
If the array Arr contains the following elements (for N = 6)
0 1 2 3 4 5
12 5 7 23 8 10
0 1 2 3 4 5
23 8 10 12 5 7
NOTE :
DO NOT DISPLAY the Changed Array contents.
Do not use any other array to transfer the contents of array Arr.
X X O X O O X O
O X O O X O X X
O O X X X X O O
X X O O O O X X
NOTE :
DO NOT DISPLAY the Changed Array contents.
Do not use any other array to transfer the contents of array M.
OR
91 9 P.T.O.
(b) Write definition for a function ColSwap(int A[4][4]) in C++, which
swaps the contents of the first column with the contents of the third
column. 2
For example :
10 15 20 25 20 15 10 25
30 35 40 45 40 35 30 45
50 55 60 65 60 55 50 65
70 75 80 85 80 75 70 85
NOTE :
DO NOT DISPLAY the Changed Array contents.
OR
91 10
(d) Write a user-defined function Pop(Book B[], int &T), which pops
the details of a Book, from the static stack of Book B, at the location
T (representing the Top end of the stack), where every Book of the
stack is represented by the following structure : 4
struct Book
{
int Bno;
char Bname[20];
};
OR
(d) For the following structure of Books in C++
struct Book
{
int Bno;
char Bname[20];
Book *Link;
};
Given that the following declaration of class BookStack in C++
represents a dynamic stack of Books :
class BookStack
{
Book *Top; //Pointer with address of Topmost Book
of Stack
public:
BookStack()
{
Top = NULL;
}
void Push(); //Function to push a Book into the
dynamic stack
void Pop(); //Function to pop a Book from the
dynamic stack
~BookStack();
};
Write the definition for the member function void
BookStack::Push(), that pushes the details of a Book into the
dynamic stack of BookStack. 4
91 11 P.T.O.
(e) Evaluate the following Postfix expression, showing the stack contents : 2
250,45,9,/,5,+,20,*,-
OR
(e) Convert the following Infix expression to its equivalent Postfix
expression, showing the stack contents for each step of conversion : 2
A + B * C ^ D - E
4. (a) A text file named MESSAGE.TXT contains some text. Another text
file named SMS.TXT needs to be created such that it would store
only the first 150 characters from the file MESSAGE.TXT.
Write a user-defined function LongToShort() in C++ that would
perform the above task of creating SMS.TXT from the already
existing file MESSAGE.TXT. 3
OR
(a) A text file named CONTENTS.TXT contains some text. Write a
user-defined function LongWords() in C++ which displays all
such words of the file whose length is more than 9 alphabets. For
example : if the file CONTENTS.TXT contains :
"Conditional statements of C++ programming language
are if and switch" 3
Then the function LongWords() should display the output as :
Conditional
statements
programming
(b) Write a user-defined function TotalPrice() in C++ to read each object
of a binary file STOCK.DAT, and display the Name from all such
records whose Price is above 150. Assume that the file STOCK.DAT
is created with the help of objects of class Stock, which is defined
below : 2
class Stock
{
char Name[20]; float Price;
public:
char* RName() { return Name; }
float RPrice() { return Price; }
};
OR
91 12
(b) A binary file DOCTORS.DAT contains records stored as objects of
the following class :
class Doctor
{
int DNo; char Name[20]; float Fees;
public:
int *GetNo() { return DNo; }
void Show()
{ cout<<Dno<<" * " <<Name<< " * " <<Fees<<endl;}
};
Write definition for function Details(int N) in C++, which displays
the details of the Doctor from the file DOCTORS.DAT, whose DNo
matches with the parameter N passed to the function. 2
(c) Find the output of the following C++ code considering that the
binary file STOCK.DAT exists on the hard disk with the following
5 records for the class STOCK containing Name and Price. 1
Name Price
Rice 110
Wheat 60
Cheese 200
Pulses 170
Sauce 150
void main()
{ fstream File
File.open("STOCK.DAT",ios::binary|ios::in);
Stock S;
for (int I=1; I<=2; I++)
{
File.seekg((2*I-1)*sizeof(S));
File.read((char*)&S, sizeof(S));
cout << "Read : " << File.tellg()/sizeof(S)<< endl;
}
File.close();
}
OR
91 13 P.T.O.
SECTION B
[Only for candidates, who opted for Python]
1. (a) Write the names of any four data types available in Python. 2
(c) Rewrite the following code in python after removing all syntax
error(s). Underline each correction done in the code. 2
250 = Number
WHILE Number<=1000:
if Number=>750:
print Number
Number=Number+100
else
print Number*2
Number=Number+50
(d) Find and write the output of the following python code : 2
Msg1="WeLcOME"
Msg2="GUeSTs"
Msg3=""
for I in range(0,len(Msg2)+1):
if Msg1[I]>="A" and Msg1[I]<="M":
Msg3=Msg3+Msg1[I]
elif Msg1[I]>="N" and Msg1[I]<="Z":
Msg3=Msg3+Msg2[I]
else:
Msg3=Msg3+"*"
print Msg3
91 14
(e) Find and write the output of the following python code : 3
def Changer(P,Q=10):
P=P/Q
Q=P%Q
print P,"#",Q
return P
A=200
B=20
A=Changer(A,B)
print A,"$",B
B=Changer(B)
print A,"$",B
A=Changer(A)
print A,"$",B
import random
VALUES=[10,20,30,40,50,60,70,80]
BEGIN=random.randint(1,3)
LAST=random.randint(BEGIN,4)
for I in range(BEGIN,LAST+1):
print VALUES[I],"-",
(i) 30 - 40 - 50 - (ii) 10 - 20 - 30 - 40 -
(iii) 30 - 40 - 50 - 60 - (iv) 30 - 40 - 50 - 60 - 70 -
91 15 P.T.O.
2. (a) Write four features of object oriented programming. 2
OR
91 16
(i) What are the methods/functions mentioned in Line 2 and
Line 7 specifically known as ?
(ii) Mention the line number of the statement, which will call
and execute the method/function shown in Line 2. 2
Instance Attributes
- Hno # House Number
- Nor # Number of Rooms
- Type # Type of the House
Methods/function
- AssignType() # To assign Type of House
# based on Number of Rooms as follows :
Nor Type
<=2 LIG
==3 MIG
>3 HIG
91 17 P.T.O.
(d) Answer the questions (i) to (iii) based on the following :
class Furniture(object): #Line 1
def __init__(self,Q): #Line 2
self.Qty = Q
def GetMore(self,TQ): #Line 3
self.Qty =self.Qty+TQ
def FRDisp(self): #Line 4
print self.Qty
91 18
(i) Write the type of the inheritance illustrated in the above. 1
(ii) Find and write the output of the above code. 2
(iii) What is the difference between the statements shown in
Line 11 and Line 12 ? 1
OR
OR
OR
OR
For example :
If the content of the file is
OR
91 21 P.T.O.
For example :
If the content of the file is
91 22
SECTION C
[For all candidates]
5. Write SQL queries for (i) to (iv) and write outputs for SQL queries (v) to
(viii), which are based on the table given below : 8
Table : TRAINS
TNO TNAME START END
11096 Ahimsa Express Pune Junction Ahmedabad Junction
12015 Ajmer Shatabdi New Delhi Ajmer Junction
1651 Pune Hbj Special Pune Junction Habibganj
13005 Amritsar Mail Howrah Junction Amritsar Junction
12002 Bhopal Shatabdi New Delhi Habibganj
12417 Prayag Raj Express Allahabad Junction New Delhi
14673 Shaheed Express Jaynagar Amritsar Junction
12314 Sealdah Rajdhani New Delhi Sealdah
12498 Shane Punjab Amritsar Junction New Delhi
12451 Shram Shakti Express Kanpur Central New Delhi
12030 Swarna Shatabdi Amritsar Junction New Delhi
Table : PASSENGERS
PNR TNO PNAME GENDER AGE TRAVELDATE
P001 13005 R N AGRAWAL MALE 45 2018-12-25
P002 12015 P TIWARY MALE 28 2018-11-10
P003 12015 S TIWARY FEMALE 22 2018-11-10
P004 12030 S K SAXENA MALE 42 2018-10-12
P005 12030 S SAXENA FEMALE 35 2018-10-12
P006 12030 P SAXENA FEMALE 12 2018-10-12
P007 13005 N S SINGH MALE 52 2018-05-09
P008 12030 J K SHARMA MALE 65 2018-05-09
P009 12030 R SHARMA FEMALE 58 2018-05-09
6. (a) State any one Distributive Law of Boolean Algebra and verify it
using truth table. 2
(d) Reduce the following Boolean Expression to its simplest form using
K-Map : 3
F(P,Q,R,S) = (0,1,2,3,5,6,7,10,14,15)
91 24
7. (a) Damodar Mohan has been informed that there had been a backdoor
entry to his computer, which has provided access to his system
through a malicious user/programs, allowing confidential and
personal information to be subjected to theft. It happened because
he clicked a link provided in one of the pop-ups from a website
announcing him to be winner of prizes worth 1 Million Dollars.
Which of the following has caused this out of the following ?
(i) Virus
(ii) Worm
(iii) Trojan Horse
Also, mention, what he should do to prevent this infection. 2
(d) Write the expanded names for the following abbreviated terms used
in Networking and Communications : 2
(i) MBPS
(ii) WAN
(iii) CDMA
(iv) WLL
91 25 P.T.O.
(e) Jonathan and Jonathan Training Institute is planning to set up its
centre in Amritsar with four specialised blocks for Medicine,
Management, Law courses alongwith an Admission block in
separate buildings. The physical distances between these blocks and
the number of computers to be installed in these blocks are given
below. You as a network expert have to answer the queries as raised
by their board of directors as given in (i) to (iv).
91 26
(i) Suggest the most suitable location to install the main server
of this institution to get efficient connectivity. 1
91 27 P.T.O.
SET-4
Series BVM/C Code No. 91
Candidates must write the Code on the
Roll No.
title page of the answer-book.
COMPUTER SCIENCE
General Instructions :
(i) SECTION A refers to programming language C++.
(ii) SECTION B refers to programming language Python.
(iii) SECTION C is compulsory for all.
(iv) Answer either SECTION A or SECTION B.
(v) It is compulsory to mention on the page 1 in the answer-book whether you
are attempting SECTION A or SECTION B.
(vi) All questions are compulsory within each section.
(vii) Questions 2(b), 2(d), 3 and 4 have internal choices.
91 1 P.T.O.
SECTION A
[Only for candidates, who opted for C++]
1. (a) Which of the following are valid operators in C++ :
(i) +=
(ii) not
(iii) = /
(iv) &&
(v)
(vi) = =
(vii) ++
(viii) and 2
(b) Write the names of the correct header files, which must be included
to compile the code successfully : 1
void main()
{
char S1[20]="CS", S2[20]="2018";
strcat(S1,S2);
cout<< S1;
}
(c) Rewrite the following C++ program after removing any/all
syntactical error(s). Underline each correction done in the code : 2
Note : Assume all required header files are already included in the
program.
#define Volume(L,B,H) = L*B*H
structure Cube
{
int Length,Breadth,Height;
};
void main()
{
Cube C = [10,15,20];
cout<<Volume(Length,Breadth,Height);
}
(d) Find and write the output of the following C++ program code : 2
Note : Assume all required header files are already included in the
program.
void Convert(char *P1, char *P2)
{
char *Q;
Q=P2;
P2=P1;
P1=Q;
cout<<P1<<"*"<<P2<<endl;
}
void main()
{
char S1[]="One", S2[]="Two";
Convert(S1,S2);
cout<<S1<<"&"<<S2<<endl;
}
91 2
(e) Find and write the output of the following C++ program code : 3
Note : Assume all required header files are already included in the
program.
void Alter(float &I, int J=2)
{
I=I+J;
J=I/J;
cout<<I<<"#"<<J<<endl;
}
void main()
{
float P=25, Q=15;
Alter(P,Q);
Alter(P);
Alter(Q);
}
(f) Observe the following C++ code and find the possible output(s) from
the options (i) to (iv) following it. Also, write the minimum and
maximum values that can possibly be assigned to the variable End. 2
Note :
Assume all the required header files are already being included in
the code.
The function random(N) generates any possible integer between
0 and N-1 (both values included).
void main()
{
randomize();
int A[]={5,10,15,20,25,30,35,40};
int Start = random(2) + 1;
int End = Start + random(4);
for(int I=Start; I<=End, I++)
cout<<A[I]<<"*";
}
91 3 P.T.O.
2. (a) Given the following class Exam and assuming all necessary header
file(s) included, answer the questions that follow the code :
class Exam
{
int Marks; char EName[20];
public:
Exam (int M) //Function 1
{
Marks = M;
}
Exam (char S[]) //Function 2
{
strcpy(EName,S);
}
Exam (char S[], int M) //Function 3
{
Marks = M;
strcpy(EName,S);
}
Exam (Exam &E) //Function 4
{
Marks = E.Marks + 10;
strcpy(EName,E.EName);
}
};
void main()
{
Exam E1(10); //Statement I
Exam E2(70); //Statement II
Exam E4("THEORY",70); //Statement III
_______________; //Statement IV
}
(i) Which of the statement(s) out of (I), (II), (III), (IV) is/are
incorrect for object(s) of the class Exam ? 1
91 4
(b) Observe the following C++ code and answer the questions (i) and (ii).
Note : Assume all necessary files are included.
class Coordinate
{
int X,Y;
public:
Coordinate(int I=20, int J=10) //Function 1
{
X = J; Y = I;
}
void Show() //Function 2
{
cout<< " Coordinates are " << X << " & " << Y <<endl;
}
~Coordinate() //Function 3
{
cout<<"Erased "<<endl;
}
};
void main()
{
Coordinate C(15);
C.Show();
}
OR
91 5 P.T.O.
(c) Write the definition of a class STATS in C++ with following
description : 4
Private Members
Code // integer
Avg // integer
array Tests */
Public Members
91 6
(d) Answer the questions (i) to (iv) based on the following : 4
class GFloor
{
int GRooms;
protected:
void Give();
public:
void Take();
};
void main()
{
SFloor S;
}
(i) Which type of Inheritance out of the following is illustrated
in the above example ?
Single Level Inheritance, Multilevel Inheritance,
Multiple Inheritance
(ii) Write the names of all the members, which are directly
accessible by the member function Get() of class FFloor.
(iii) Write the names of all the members, which are directly
accessible by the member function Input() of class SFloor.
(iv) Write the names of all the members, which are directly
accessible by the object S of class SFloor declared in the
main() function.
OR
91 7 P.T.O.
(d) Consider the following class Institution 4
class Institution
{
int Code;
char Course[20];
protected :
float Fee;
public:
void Reg(){cin>>Code;gets(Course);cin>>Fee;}
void Show(){cout<<Code<<Course<<Fee<<endl;}
};
Write a code in C++ to publicly derive another class Student from
the base class Institution with following members.
Data Members
Rno of type long
Name of type character of size 10
Member Functions
A constructor function to assign Rno as 100
Admit() to allow user to enter Rno and Name
Display() to display Rno and Name
0 1 2 3 4
25 8 15 49 9
0 1 2 3 4 5
7 5 12 10 8 23
NOTE :
DO NOT DISPLAY the Changed Array contents.
Do not use any other array to transfer the contents of array Arr.
1 1 0 1 0 0 1 0
0 1 0 0 1 0 1 1
0 0 1 1 1 1 0 0
1 1 0 0 0 0 1 1
NOTE :
DO NOT DISPLAY the Changed Array contents.
Do not use any other array to transfer the contents of array M.
OR
91 9 P.T.O.
(b) Write a user-defined function RowSwap(int A [4] [4]) in C++,
which swaps the contents of the first row with the contents of the
third row. 2
For example :
10 15 20 25 50 55 60 65
30 35 40 45 30 35 40 45
50 55 60 65 10 15 20 25
70 75 80 85 70 75 80 85
NOTE :
OR
91 10
(d) For the following structure of Items in C++
struct Item
{
char Name[20];
float Price;
Item *Link;
};
Given that the following declaration of class ItemStack in C++
represents a dynamic stack of Items :
class ItemStack
{
Item *Top; //Pointer with address of Topmost Item
of Stack
public:
ItemStack()
{
Top = NULL;
}
void Push(); //Function to push an Item into the
dynamic stack
void Pop(); //Function to pop an Item from the
dynamic stack
~ItemStack();
};
Write the definition for the member function void ItemStack::Pop(),
that pops the details of an Item from the dynamic stack of
ItemStack. 4
OR
(d) Write a user-defined function Push(Item S[], int &T), which
pushes the details of an Item, into the static stack of Items S, at the
location T (representing the Top end of the stack), where every Item
to be pushed into the stack is represented by the following structure : 4
struct Item
{
char Name[20];
float Price;
};
91 11 P.T.O.
(e) Convert the following Infix expression to its equivalent Postfix
expression, showing the stack contents for each step of conversion : 2
P – Q / R ^ S + T
OR
(e) Evaluate the following Postfix expression, showing the stack
contents : 2
150,25,5,/,45,+,2,*,-
4. (a) A text file named IONS.TXT contains some text. Write a
user-defined function ShowP() in C++ which displays all
such words of the file which start with alphabet 'P'. 3
For example : If the file IONS.TXT contains :
"Whether an atom will form a cation or an anion is
based on its position in the periodic table"
Then the function ShowP() should display the output as
position, periodic
OR
(a) A text file named BIG.TXT contains some text. Another text file
named SMALL.TXT needs to be created such that it would store
only the first 50 characters from the file BIG.TXT.
Write a user-defined function BigToSmall() in C++ that would
perform the above task of creating SMALL.TXT from the already
existing file BIG.TXT. 3
91 12
(b) Write a user-defined function TotalCost() in C++ to read each object
of a binary file ITEMS.DAT, and display the Name from all such
records, whose Cost is above 150. Assume that the file ITEMS.DAT is
created with the help of objects of class Item, which is defined
below : 2
class Item
{
char Name[20]; float Cost;
public:
char* RName() { return Name; }
float RCost() { return Cost; }
};
(c) Find the output of the following C++ code considering that the
binary file ITEMS.DAT exists on the hard disk with the following
5 records for the class Item containing Name and Cost. 1
Name Cost
Rice 110
Wheat 60
Cheese 200
Pulses 170
Sauce 150
void main()
{
fstream File;
File.open("ITEMS.DAT",ios::binary|ios::in);
Item T;
for (int I=1; I<=2; I++)
{
File.seekg((2*I-1)*sizeof(T));
File.read((char*)&T, sizeof(T));
cout<<"Read :"<<File.tellg()/sizeof(T)<<endl;
}
File.close();
}
OR
91 13 P.T.O.
SECTION B
[Only for candidates, who opted for Python]
1. (a) Which of the following are valid operators in Python ? 2
(i) +=
(ii) ^
(iii) in
(iv) &&
(v) between
(vi) */
(vii) is
(viii) like
(d) Find and write the output of the following Python code : 2
Str1="EXAM2018"
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
91 14
(e) Find and write the output of the following Python code : 3
def Alter(P=15,Q=10):
P=P*Q
Q=P/Q
print P,"#",Q
return Q
A=100
B=200
A=Alter(A,B)
print A,"$",B
B=Alter(B)
print A,"$",B
A=Alter(A)
print A,"$",B
import random
VAL=[80,70,60,50,40,30,20,10]
Start=random.randint(1,3)
End=random.randint(Start,4)
for I in range(Start,End+1):
print VAL[I],"*",
(i) 40 * 30 * 20 * 10 * (ii) 70 * 60 * 50 * 40 * 30 *
(iii) 50 * 40 * 30 * (iv) 60 * 50 * 40 * 30 *
91 15 P.T.O.
2. (a) What is an Abstract Method in a class of Python ? Write a code in
Python to illustrate use of an Abstract Method in Python. 2
(b) class Matter:
Vol = 10
Type="SOLID"
def __init__(self,T,V=30):
self.Type = T
self.Vol = V
def Disp(self):
print self.Type,Matter.Type
print self.Vol,Matter.Vol
M1=Matter("GAS",20)
M1.Disp()
Matter.Type="LIQUID"
M2=Matter("SOLID")
M2.Disp()
OR
(ii) Mention the line number of the statement, which will call
and execute the method/function shown in Line 2. 2
Instance Attributes
- Vno # Vehicle Number
- Vehicle # Vehicle Name
- Type # Type of the Vehicle
Methods/Functions
- FindType() # To assign Type of Vehicle
# based on Name of the Vehicle as shown
# below :
Vehicle Type
MotorCycle MCYCL
Car MTV
Truck HTV
Bus HTV
91 17 P.T.O.
(d) Answer the questions (i) to (iii) based on the following :
class Super(object): #Line 1
def __init__(self,n): #Line 2
self.N = n
def Set(self,n): #Line 3
self.n =self.N+n
def SPShow(self): #Line 4
print self.N
OR
OR
91 19 P.T.O.
(b) Write definition of a method/function FindOut(Names, HisName)
to search for HisName string from a list Names, and display the
position of its presence. 3
For example :
If the Names contain ["Arun","Raj","Tarun","Kanika"]
and HisName contains "Tarun"
OR
Note : Assuming that the list has even number of values in it.
For example :
If the list Numbers contain
[25,17,19,13,12,15]
After swapping the list content should be displayed as
[17,25,13,19,15,12]
OR
91 20
(d) Write a Python method/function Count(Start,End,Step) to display
natural numbers from Start. 2
End in equal intervals of Step
For example :
If the values of Start as 14, End as 35 and Step as 6
The method should be displayed as
14
20
26
32
OR
OR
91 21 P.T.O.
(b) Write a method/function BIGWORDS() in Python to read contents
from a text file CODE.TXT, to count and display the occurrence of
those words, which are having 5 or more alphabets. 2
For example :
If the content of the file is
ME AND MY FRIENDS
ENSURE SAFETY AND SECURITY OF EVERYONE
OR
For example :
If the content of the file is
91 22
(c) Considering the following definition of class ITEMS, write a
method/function LowStock() in Python to search and display
Iname and Qty from a pickled file STOCK.DAT, for the items, whose
Qty is less than 10. 3
class ITEMS :
def __init__(self,I,Q):
self.Iname=N
self.Qty=Q
def IDisp(self):
print self.Iname,"@",self.Qty
OR
def __init__(self,N,T):
self.Name=N
self.Type=T
def Disp(self):
print self.Name,"$",self.Type
91 23 P.T.O.
SECTION C
[For all candidates]
5. (a) Observe the following table STOCK carefully and answer the
questions that follow : 2
Table : STOCK
SNO NAME PRICE
101 PEN 50
102 PENCIL 5
103 PENCIL 10
104 NOTEBOOK 50
105 ERASER 5
Which attribute out of SNO, NAME and PRICE is the ideal one for
being considered as the Primary Key and why ?
(b) Write SQL queries for (i) to (iv) and write outputs for SQL queries
(v) to (viii), which are based on the tables given below : 6
Table : TRAINS
TNO TNAME START END
11096 Ahimsa Express Pune Junction Ahmedabad Junction
12015 Ajmer Shatabdi New Delhi Ajmer Junction
1651 Pune Hbj Special Pune Junction Habibganj
13005 Amritsar Mail Howrah Junction Amritsar Junction
12002 Bhopal Shatabdi New Delhi Habibganj
12417 Prayag Raj Express Allahabad Junction New Delhi
14673 Shaheed Express Jaynagar Amritsar Junction
12314 Sealdah Rajdhani New Delhi Sealdah
12498 Shan-e-Punjab Amritsar Junction New Delhi
12451 Shram Shakti Express Kanpur Central New Delhi
12030 Swarna Shatabdi Amritsar Junction New Delhi
91 24
Table : PASSENGERS
PNR TNO PNAME GENDER AGE TRAVELDATE
P001 13005 R N AGRAWAL MALE 45 2018-12-25
P002 12015 P TIWARY MALE 28 2018-11-10
P003 12015 S TIWARY FEMALE 22 2018-11-10
P004 12030 S K SAXENA MALE 42 2018-10-12
P005 12030 S SAXENA FEMALE 35 2018-10-12
P006 12030 P SAXENA FEMALE 12 2018-10-12
P007 13005 N S SINGH MALE 52 2018-05-09
P008 12030 J K SHARMA MALE 65 2018-05-09
P009 12030 R SHARMA FEMALE 58 2018-05-09
6. (a) State any one Absorption Law of Boolean Algebra and verify it using
truth table. 2
(d) Reduce the following Boolean Expression to its simplest form using
K-Map : 3
F(P,Q,R,S) = (2,6,7,8,9,10,11,13,14,15)
7. (a) William Jones has got a file that is replicating itself in order to
spread to other computers using computer network on its own,
relying on security failures on the target computer to access it. It is
consuming a lot of network bandwidth also. Which of the following
type category of infection will it be considered ? Also, mention, what
should he do to prevent this infection ? 2
(i) Virus
(ii) Worm
(iii) Trojan Horse
(d) Write the expanded names for the following abbreviated terms used
in Networking and Communications : 2
(i) HTML
(ii) PAN
(iii) TCP
(iv) GBPS
91 27 P.T.O.
Number of computers installed at various locations are as follows :
Design Unit 40
Media Unit 50
HR Unit 110
Training Unit 40
(i) Suggest the most suitable location to install the main server
of this institution to get efficient connectivity. 1
91 28
Code No. 91/C
Candidates must write the Code on the
Roll No.
title page of the answer-book.
General Instructions :
.91/D 1 P.T.O.
SECTION A
1. (a) Which of the following is not a valid variable name in Python ?
Justify reason for it not being a valid name. 1
(i) 5Radius
(ii) Radius_
(iii) _Radius
(iv) Radius
(b) Which of the following are keywords in Python ? 1
(i) break
(ii) check
(iii) range
(iv) while
(c) Name the Python Library modules which need to be imported to
invoke the following functions : 1
(i) cos()
(ii) randint()
(d) Rewrite the following code in Python after removing all syntax
error(s). Underline each correction done in the code. 2
input('Enter a word',W)
if W = 'Hello'
print('Ok')
else:
print('Not Ok')
(e) Find and write the output of the following Python code : 2
def ChangeVal(M,N):
for i in range(N):
if M[i]%5 == 0:
M[i] //= 5
if M[i]%3 == 0:
M[i] //= 3
L=[25,8,75,12]
ChangeVal(L,4)
for i in L :
print(i, end='#')
.91/D 2
(f) Find and write the output of the following Python code : 3
def Call(P=40,Q=20):
P=P+Q
Q=P–Q
print(P,'@',Q)
return P
R=200
S=100
R=Call(R,S)
print (R,'@',S)
S=Call(S)
print(R,'@',S)
Colours = ["VIOLET","INDIGO","BLUE","GREEN",
"YELLOW","ORANGE","RED"]
End = randrange(2)+3
Begin = randrange(End)+1
for i in range(Begin,End):
print(Colours[i],end="&")
(i) INDIGO&BLUE&GREEN& (ii) VIOLET&INDIGO&BLUE&
(iii) BLUE&GREEN&YELLOW& (iv) GREEN&YELLOW&ORANGE&
2. (a) Write the names of the immutable data objects from the following : 1
(i) List
(ii) Tuple
(iii) String
(iv) Dictionary
.91/D 3 P.T.O.
(b) Write a Python statement to declare a Dictionary named ClassRoll
with Keys as 1, 2, 3 and corresponding values as 'Reena',
'Rakesh', 'Zareen' respectively. 1
(c) Which of the options out of (i) to (iv) is the correct data type for the
variable Vowels as defined in the following Python statement ? 1
Vowels = ('A', 'E', 'I', 'O', 'U')
(i) List
(ii) Dictionary
(iii) Tuple
(iv) Array
X=20
Update()
print('X = ', X)
(f) Differentiate between ‘‘w’’ and ‘‘r’’ file modes used in Python.
Illustrate the difference using suitable examples. 2
(g) A pie chart is to be drawn (using pyplot) to represent Pollution Level
of Cities. Write appropriate statements in Python to provide labels
for the pie slices as the names of the Cities and the size of each pie
slice representing the corresponding Pollution of the Cities as per
the following table : 2
Cities Pollution
Mumbai 350
Delhi 475
Chennai 315
Bangalore 390
OR
.91/D 4
Write the output from the given Python code : 2
OR
OR
.91/D 5 P.T.O.
Write a Recursive function in Python Power(X,N), to return the
result of X raised to the power N where X and N are non-negative
integers. For example, if X is 5 and N is 3 then the function should
return the result of (5)3 i.e. 125. 3
(j) Write functions in Python for PushS(List) and for PopS(List) for
performing Push and Pop operations with a stack of List containing
integers. 4
OR
SECTION B
3. Fill in the blanks from questions 3(a) to 3(d).
(b) ___________ is a network tool used to test the download and upload
broadband speed. 1
(i) POP
(ii) VoIP
(iii) NFC
(iv) FTP
.91/D 6
(f) Match the ServiceNames listed in the first column of the following
table with their corresponding features listed in the second column
of the table : 2
Technology Feature
IP based Protocols (LTE)
1G
True Mobile Broadband
Improved Data Services with
2G Multimedia
Mobile Broadband
Basic Voice Services
3G
Analog-based Protocol
Better Voice Services
4G Basic Data Services
First Digital Standards (GSM, CDMA)
(h) Helping Hands is an NGO with its head office at Mumbai and
branches located at Delhi, Kolkata and Chennai. Their Head Office
located at Delhi needs a communication network to be established
between the head office and all the branch offices. The NGO has
received a grant from the national government for setting up the
network. The physical distances between the branch offices and the
head office and the number of computers to be installed in each of
these branch offices and the head office are given below. You, as a
network expert, have to suggest the best possible solutions for the
queries as raised by the NGO, as given in (i) to (iv).
.91/D 7 P.T.O.
Distances between various locations in Kilometres :
(ii) Suggest the most suitable location to install the main server
of this NGO to communicate data with all the offices. 1
.91/D 8
(iii) Write the name of the type of network out of the following,
which will be formed by connecting all the computer systems
across the network : 1
(A) WAN
(B) MAN
(C) LAN
(D) PAN
.91/D 9 P.T.O.
(i) What is the Degree of the table EMPLOYEES ? What is the
cardinality of the table DEPARTMENT ?
(ii) What is a Primary Key ? Explain.
OR
(f) Write whether the following statements are True or False for the
GET and POST methods in Django : 2
(i) POST requests are never cached.
(ii) GET requests do not remain in the browser history.
(g) Write outputs for SQL queries (i) to (iii), which are based on the
following tables, CUSTOMERS and PURCHASES : 3
Table : CUSTOMERS Table : PURCHASES
CNO CNAME CITIES SNO QTY PUR_DATE CNO
C1 SANYAM DELHI S1 15 2018-12-25 C2O
C2 SHRUTI DELHI S2 10 2018-11-10 C1
C3 MEHER MUMBAI S3 12 2018-11-10 C4
C4 SAKSHI CHENNAI S4 7 2019-01-12 C7
C5 RITESH INDORE S5 11 2019-02-12 C2
C6 RAHUL DELHI S6 10 2018-10-12 C6
C7 AMEER CHENNAI S7 5 2019-05-09 C8
C8 MINAKSHI BANGALORE S8 20 2019-05-09 C3
C9 ANSHUL MUMBAI S9 8 2018-05-09 C9
S10 15 2018-11-12 C5
S11 6 2018-08-04 C7
.91/D 10
(h) Write SQL queries for (i) to (iv), which are based on the tables :
CUSTOMERS and PURCHASES given in the question 4(g) : 4
SECTION D
.91/D 11 P.T.O.
(d) Consider the following scenario and answer the questions which
follow : 2
‘‘A student is expected to write a research paper on a topic. The
student had a friend who took a similar class five years ago. The
student asks his older friend for a copy of his paper and then
takes the paper and submits the entire paper as his own research
work.’’
(i) Which of the following activities appropriately categorises
the act of the writer ?
(A) Plagiarism
(B) Spamming
(C) Virus
(D) Phishing
(ii) Which kind of offense out of the following is made by the
student ?
(A) Cyber Crime
(B) Civil Crime
(C) Violation of Intellectual Property Rights
(e) What are Digital Rights ? Write examples for two digital rights
applicable to usage of digital technology. 2
.91/D 12
Series /C SET~4
Code No. 91
Roll No.
Candidates must write the Code on the
title page of the answer-book.
NOTE :
(i) Please check that this question paper contains 13 printed pages.
(ii) Code number given on the right hand side of the question paper should be
written on the title page of the answer-book by the candidate.
(iii) Please write down the serial number of the question in the answer-book before
attempting it.
(iv) 15 minute time has been allotted to read this question paper. The question paper
will be distributed at 10.15 a.m. From 10.15 a.m. to 10.30 a.m., the students
will read the question paper only and will not write any answer on the
answer-book during this period.
91 Page 1 P.T.O.
General Instructions :
(i) This question paper contains two parts Part A and B. Each part is compulsory.
(ii) Both Part A and Part B have choices.
(iii) Part A has two sections :
a. Section I is short answer questions, to be answered in one word or one line.
b. Section II has two case study-based questions. Each case study has
5 case-based subparts. An examinee is to attempt any 4 out of the 5 subparts.
(iv) Part B is Descriptive Paper.
(v) Part B has three sections :
a. Section I is short answer questions of 2 marks each in which two questions 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
an internal option.
(vi) All programming questions are to be answered using Python Language only.
PART A
Section I
Select the most appropriate option out of the options given for each question. Attempt any
15 questions from questions no. 1 to 21.
3. Identify the statement(s) from the following options which will raise TypeError
exception(s) : 1
(A) print('5' * 3)
(B) print( 5 * 3)
(C) print('5' + 3)
(D) print('5' + '3')
91 Page 2
4. Identify the valid relational operator(s) in Python from the following : 1
(A) =
(B) <
(C) <>
(D) not
6. Write a single line statement in Python to assign the values 'BLUE', 'GREEN', 'RED'
to a tuple named Colours. 1
8. Write the name of the built-in function/method of the math module which when
executed upon 5.8 as parameter, would return the nearest smaller integer 5. 1
9. In context of Communication Networks, which of the following is the correct expansion for
the abbreviation PAN : 1
(A) Prime Area Network
(B) Post Application Network
(C) Picture Application Network
(D) Personal Area Network
10. In context of Cyber Crimes and Cyber Thefts, the term IPR refers to : 1
(A) Internet Protocol Rights
(B) Inter Personnel Rights
(C) Intellectual Property Rights
(D) Individual Property Rights
11. In SQL, write the name of the aggregate function which will display the cardinality of a
table. 1
12. Which of the following clauses in SQL is most appropriate to use to select matching tuples
in a specific range of values ? 1
(A) IN
(B) LIKE
(C) BETWEEN
(D) IS
91 Page 3 P.T.O.
13. Which of the following is not a valid datatype in SQL ? 1
(A) DATE
(B) STRING
(C) DECIMAL
(D) CHAR
15. Which of the following wireless transmission media is best suited for MAN ? 1
(A) Microwave
(B) Radio Link
(C) Infrared
(D) Bluetooth
17. What shall be the ouput for the execution of the following Python Code ? 1
Cities = ['Delhi', 'Mumbai']
Cities[0], Cities[1] = Cities[1], Cities[0]
print(Cities)
18. Which of the following commands in SQL is used to add a new record into a table ? 1
(A) ADD
(B) INSERT
(C) UPDATE
(D) NEW
19. Which of the following is the correct expansion of DML in context of SQL ? 1
(A) Direct Machine Language
(B) Data Mixing Language
(C) Distributed Machine Language
(D) Data Manipulation Language
91 Page 4
20. Which of the following statements correctly explains the term Firewall in context of
Computer Network Society ? 1
(A) A device that protects the computer network from catching fire.
(B) A device/software that controls incoming and outgoing network traffic.
(C) Using abusive language on a social network site.
(D) Stea it as his/her own work.
21. Which of the following protocols allows the use of HTML on the World Wide Web ? 1
(A) HTTP
(B) PPP
(C) FTP
(D) POP
Section II
Both the case study-based questions are compulsory. Attempt any 4 sub-parts from each question.
Each question carries 1 mark.
22. Anmol maintains that database of Medicines for his pharmacy using SQL to store the
data. The structure of the table PHARMA for the purpose is as follows :
Name of the table - PHARMA
The attributes of PHARMA are as follows :
MID - numeric
MNAME - character of size 20
PRICE - numeric
UNITS - numeric
EXPIRY - date
Table : PHARMA
91 Page 5 P.T.O.
(c) Anmol has received a new medicine to be added into his stock, but for which
he does not know the number of UNITS. So he decides to add the medicine
without its value for UNITS. The rest of the values are as follows :
91 Page 6
(a) Name the module she will import in Line 1. 1
(b) In which mode will she open the file to add data into the file in Line 2 ? 1
(c) In which mode will she open the file to read the data from the file in Line 3 ? 1
(d) File in the blank in Line 4 to read the data from a CSV file. 1
(e) Fill in the blank in Line 5 to close the file. 1
PART B
Section I
24. Evaluate the following Python expressions : 2
(a) 2 * 3 + 4 ** 2 5 // 2
OR
(b) Differentiate between the terms Domain Name and URL in context of web
services. Also write one example of each to illustrate the difference. 2
26. Expand the following terms in context of Computer Networks : 2
(a) PPP
(b) VoIP
(c) GSM
(d) WLL
27. (a) Explain the use of positional parameters in a Python function with the help of a
suitable example. 2
OR
(b) Explain the use of a default parameter in a Python function with the help of a
suitable example. 2
28. Rewrite the following code in Python after removing all syntax error(s) : 2
Underline each correction done in the code.
Runs = ( 10, 5, 0, 2, 4, 3 )
for I in Runs:
if I=0:
print(Maiden Over)
else
print(Not Maiden)
91 Page 7 P.T.O.
29. What possible output(s) is/are expected to be displayed on the screen at the time of
execution of the program from the following code ? Also specify the maximum and
minimum value that can be assigned to the variable R when K is assigned value as 2. 2
import random
Signal = [ 'Stop', 'Wait', 'Go' ]
for K in range(2, 0, 1):
R = randrange(K)
print (Signal[R], end = ' # ')
(c) Go # Wait #
(d) Go # Stop #
30. What are Tuples in a SQL Table ? Write a suitable example with a SQL Table to
illustrate your answer. 2
31. For the following SQL Table named PASSENGERS in a database TRAVEL:
A cursor named Cur is created in Python for a connection of a host which contains the
database TRAVEL. Write the output for the execution of the following Python statements
for the above SQL Table PASSENGERS: 2
Cur.execute('USE TRAVEL')
Cur.execute('SELECT * FROM PASSENGERS')
Recs=Cur.fetchall()
for R in Recs:
print(R[1])
32. Write the names of any two constraints and their respective uses in SQL. 2
91 Page 8
33. Write the output for the execution of the following Python code : 2
def change(A):
S=0
for i in range(len(A)//2):
S+=(A[i]*2)
return S
B = [10,11,12,30,32,34,35,38,40,2]
C = Change(B)
Print('Output is',C)
Section II
34. Write the definition of a function Sum3(L) in Python, which accepts a list L of integers
and displays the sum of all such integers from the list L which end with the digit 3. 3
then the function should display the sum of 123, 13, 23, i.e. 159 as follows :
Sum of integers ending with digit 3 = 159
35. (a) Write the definition of a function ChangeGender() in Python, which reads the
contents of a text file "BIOPIC.TXT" and displays the content of the file with
every occurrence of the word 'he' replaced by 'she'. For example, if the
content of the file "BIOPIC.TXT" is as follows : 3
Last time he went to Agra,
there was too much crowd, which he did not like.
So this time he decided to visit some hill station.
The function should read the file content and display the output as follows :
Last time she went to Agra,
there was too much crowd, which she did not like.
So this time she decided to visit some hill station.
OR
91 Page 9 P.T.O.
(b) Write the definition of a function Count_Line() in Python, which should read
each line of a text file "SHIVAJI.TXT" and count total number of lines present in
text file. For example, if the content of the file "SHIVAJI.TXT" is as follows : 3
36. Write the outputs of the SQL queries (i) to (iii) based on the relations CUSTOMER and
TRANSACTION given below : 3
Table : CUSTOMER
C1 RISHABH M 15000
C2 AAKASH M 12500
C3 INDIRA F 9750
C4 TUSHAR M 14600
C5 ANKITA F 22000
Table : TRANSACTION
91 Page 10
37. (a) Write the definition of a function POP_PUSH(LPop, LPush, N) in Python. The
function should Pop out the last N elements of the list LPop and Push them into
the list LPush. For example : 3
If the contents of the list LPop are [10, 15, 20, 30]
And value of N passed is 2,
then the function should create the list LPush as [30, 20]
And the list LPop should now contain [10, 15]
NOTE : If the value of N is more than the number of elements present in
LPop, then display the message "Pop not possible".
OR
(b) Write a function in Python POPSTACK(L) where L is a stack implemented by a
list of numbers. The function returns the value deleted from the stack. 3
Section III
38. A school library is connecting computers in its units in a LAN. The library has 3 units as
shown in the diagram below : 5
91 Page 11 P.T.O.
(a) Suggest the most suitable place (i.e. the Unit name) to install the server of
this Library with a suitable reason.
(b) Suggest an ideal layout for connecting these Units for a wired connectivity.
(c) Which device will you suggest to be installed and where should it be placed to
provide Internet connectivity to all the Units ?
(d) Suggest the type of the most efficient and economical wired medium for
connecting all the computers in the network.
(e) The university is planni
computer which is in his office at a distance of 50 metres. Which type of
network out of LAN, MAN or WAN will be used for the network ? Justify your
answer.
39. Write SQL statements for the following queries (i) to (v) based on the relations
CUSTOMER and TRANSACTION given below : 5
Table : CUSTOMER
C1 RISHABH M 15000
C2 AAKASH M 12500
C3 INDIRA F 9750
C4 TUSHAR M 14600
C5 ANKITA F 22000
Table : TRANSACTION
(a) To display all information about the CUSTOMERs whose NAME starts with
'A'.
(b) To display the NAME and BALANCE of Female CUSTOMERs (with GENDER as
'F') whose TRANSACTION Date (TDATE) is in the year 2019.
(c) To display the total number of CUSTOMERs for each GENDER.
(d) To display the CUSTOMER NAME and BALANCE in ascending order of GENDER.
(e) To display CUSTOMER NAME and their respective INTEREST for all
CUSTOMERs where INTEREST is calculated as 8% of BALANCE.
91 Page 12
40. (a) A binary file "PLANTS.dat" has structure (ID, NAME, PRICE).
Write the definition of a function countrec()in Python that would read contents
of the file "PATIENTS.dat" and display the details of those patients who have
the DISEASE as 'COVID-19'. The function should also display the total number
of such patients whose DISEASE is 'COVID-19'. 5
91 Page 13 P.T.O.
SET-4
Series %BAB%/C
Q.P. Code
91
COMPUTER SCIENCE
91 Page 1 P.T.O.
SECTION A
(Each question carries 2 marks)
(b) Out of the following, which has the largest network coverage area ? 1
Assume that the required library for establishing the connection between
Python and MySQL is already imported in the given Python code.
Also assume that DB is the name of the database connection for the given
table EMPLOYEE stored in the database COMPANY.
91 Page 2
5. Write the output of the SQL queries (a) to (d) based on the table TRAVEL
given below : 2
Table : TRAVEL
T_ID START END T_DATE FARE
101 DELHI CHENNAI 2021-12-25 4500
102 DELHI BENGALURU 2021-11-20 4000
103 MUMBAI CHENNAI 2020-12-10 5500
104 DELHI MUMBAI 2019-12-20 4500
105 MUMBAI BENGALURU 2022-01-15 5000
6. Write the output of the SQL queries (a) and (b) based on the following two
tables FLIGHT and PASSENGER belonging to the same database : 2
Table : FLIGHT
FNO DEPART ARRIVE FARE
F101 DELHI CHENNAI 4500
F102 DELHI BENGALURU 4000
F103 MUMBAI CHENNAI 5500
F104 DELHI MUMBAI 4500
F105 MUMBAI BENGALURU 5000
91 Page 3 P.T.O.
Table : PASSENGER
PNO NAME FLIGHTDATE FNO
P1 PRAKASH 2021-12-25 F101
P2 NOOR 2021-11-20 F103
P3 HARMEET 2020-12-10 NULL
P4 ANNIE 2019-12-20 F105
OR
(i) Identify and write the name of the Candidate Keys in the
given table BATSMEN.
(ii) How many tuples are there in the given table BATSMEN ? 2
91 Page 4
SECTION B
(Each question carries 3 marks)
91 Page 5 P.T.O.
9. (a) A SQL table BOOKS contains the following column names :
BOOKNO, BOOKNAME, QUANTITY, PRICE, AUTHOR
Write the SQL statement to add a new column REVIEW to store the
reviews of the book. 1
(b) Write the names of any two commands of DDL and any two
commands of DML in SQL. 2
10. Rashmi has forgotten the names of the databases, tables and the structure
of the tables that she had created in Relational Database Management
System (RDBMS) on her computer.
(a) Write the SQL statement to display the names of all the databases
present in RDBMS application on her computer.
(b) Write the statement which she should execute to open the database
named "STOCK".
(c) Write the statement which she should execute to display the
structure of the table "ITEMS" existing in the above opened
database "STOCK". 3
SECTION C
(Each question carries 4 marks)
11. Write SQL queries for (a) to (d) based on the tables CUSTOMER and
TRANSACT given below : 4
Table : CUSTOMER
CNO NAME GENDER ADDRESS PHONE
1001 Suresh MALE A-123, West Street 9310010010
1002 Anita FEMALE C-24, Court Lane 9121211212
1003 Harjas MALE T-1, Woods Avenue 9820021001
Table : TRANSACT
TNO CNO AMOUNT TTYPE TDATE
T1 1002 2000 DEBIT 2021-09-25
T2 1003 1500 CREDIT 2022-01-28
T3 1002 3500 CREDIT 2021-12-31
T4 1001 1000 DEBIT 2022-01-10
91 Page 6
(a) Write the SQL statements to delete the records from table
TRANSACT whose amount is less than 1000.
(b) Write a query to display the total AMOUNT of all DEBITs and all
CREDITs.
(c) Write a query to display the NAME and corresponding AMOUNT of all
CUSTOMERs who made a transaction type (TTYPE) of CREDIT.
(d) Write the SQL statement to change the Phone number of customer
whose CNO is 1002 to 9988117700 in the table CUSTOMER.
OR
(b) Write the names of two wired and two wireless data transmission
mediums. 2
13. The government has planned to develop digital awareness in the rural
areas of the nation. According to the plan, an initiative is taken to set up
Digital Training Centers in villages across the country with its Head
Office in the nearest cities. The committee has hired a networking
consultancy to create a model of the network in which each City Head
Office is connected to the Training Centers situated in 3 nearby villages.
Village 3
Training
Village 2 Center
Training
Center
91 Page 8
(a) It is observed that there is a huge data loss during the process of
data transfer from one village to another. Suggest the most
appropriate networking device out of the following, which needs to
be placed along the path of the wire connecting one village with
another to refresh the signal and forward it ahead.
(i) MODEM
(ii) ETHERNET CARD
(iii) REPEATER
(iv) HUB
(c) Which hardware networking device, out of the following, will you
suggest to connect all the computers within the premises of every
Village Training Center ?
(i) SWITCH
(ii) MODEM
(iii) REPEATER
(iv) ROUTER
(d) Which protocol, out of the following, will be most helpful to conduct
online interactions of Experts from the City Head Office and people
at the three Village Training Centers ?
(i) FTP
(ii) PPP
(iii) SMTP
(iv) VoIP
91 Page 9 P.T.O.
Series HEFG/C Set-4
Q.P. Code 91
Roll No.
$*
General Instructions :
This question paper contains five sections, Section A to E.
All questions are compulsory.
Section A has 18 questions carrying 1 mark each.
Section B has 7 Very Short Answer (VSA) type questions carrying 2 marks each.
Section C has 5 Short Answer (SA) type questions carrying 3 marks each.
Section D has 3 Long Answer (LA) type question carrying 5 marks each.
Section E has 2 questions carrying 4 marks each. One internal choice is given
in Q 35 against part C only.
All programming questions are to be answered using Python Language only.
91 ^ Page 1 of 19 P.T.O.
SECTION A
(a) Dictionary
(b) String
(c) List
(d) Tuple
(a) Day.pop()
(b) Day.pop(2)
(c) Day.pop(1)
(d) Day.pop("Tuesday")
(c) NONE
(d) NULL
91 Page 2 of 19
5. Select the correct output of the code :
S="Amrit Mahotsav @ 75"
A=S.split(" ",2)
print(A)
(a) ('Amrit', 'Mahotsav', '@', '75')
(b) ['Amrit', 'Mahotsav', '@ 75']
(c) ('Amrit', 'Mahotsav', '@ 75')
(d) ['Amrit', 'Mahotsav', '@', '75']
6. Which of the following modes in Python creates a new file, if file does not
exist and overwrites the content, if the file exists ?
(a) r+ (b) r
(c) w (d) a
91 Page 4 of 19
14. What will the following expression be evaluated to in Python ?
print(6/3 + 4**3//8 4)
(a) 6.5
(b) 4.0
(c) 6.0
(d) 4
15. Which of the following functions is a valid built-in function for both list
and dictionary datatype ?
(a) items()
(b) len()
(c) update()
(d) values()
16. fetchone() method fetches only one row in a ResultSet and returns a
__________.
(a) Tuple
(b) List
(c) Dictionary
(d) String
Q. 17 and 18 are Assertion (A) and Reasoning (R) 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).
18. Assertion (A) : readlines() reads all the lines from a text file and
returns the lines along with newline as a list of strings.
Reasoning (R) : readline() can read the entire text file line by line
without using any looping statements.
SECTION B
20. (a) Write any two differences between Fiber-optic cable and Coaxial
cable. 2
OR
(b) Write one advantage and one disadvantage of wired over wireless
communication. 2
91 Page 6 of 19
21. (a) Given is a Python string declaration : 1
NAME = "Learning Python is Fun"
Write the output of : print(NAME[-5:-10:-1])
24. (a) Write the output of the Python code given below : 2
g=0
def fun1(x,y):
global g
g=x+y
return g
def fun2(m,n):
global g
g=m-n
return g
k=fun1(2,3)
fun2(k,7)
print(g)
OR
91 Page 7 of 19 P.T.O.
(b) Write the output of the Python code given below : 2
a=15
def update(x):
global a
a+=2
if x%2==0:
a*=x
else:
a//=x
a=a+5
print(a,end="$")
update(5)
print(a)
SECTION C
Table : Sport
ADMNO GAME
1100 CRICKET
1103 FOOTBALL
91 Page 8 of 19
(b) Write the output of the queries (i) to (iv) based on the table,
GARMENT given below : 2
TABLE : GARMENT
GCODE TYPE PRICE FCODE ODR_DATE
G101 EVENING GOWN 850 F03 2008-12-19
G102 SLACKS 750 F02 2020-10-20
G103 FROCK 1000 F01 2021-09-09
G104 TULIP SKIRT 1550 F01 2021-08-10
G105 BABY TOP 1500 F02 2020-03-31
G106 FORMAL PANT 1250 F01 2019-01-06
27. (a) Write a function in Python that displays the book names having
y in their name from a text file Bookname.t 3
Example :
s the names of following books :
OR
91 Page 9 of 19 P.T.O.
(b) Write a function RevString()
prints the words The rest of the
content is displayed normally. 3
Example :
If content in the text file is :
UBUNTU IS AN OPEN SOURCE OPERATING SYSTEM
Output will be :
UBUNTU IS AN NEPO SOURCE GNITAREPO SYSTEM
28. Write the output of any three SQL queries (i) to (iv) based on the tables
COMPANY and CUSTOMER given below : 3
Table : COMPANY
CID C_NAME CITY PRODUCTNAME
111 SONY DELHI TV
222 NOKIA MUMBAI MOBILE
333 ONIDA DELHI TV
444 SONY MUMBAI MOBILE
555 BLACKBERRY CHENNAI MOBILE
666 DELL DELHI LAPTOP
Table : CUSTOMER
CUSTID CID NAME PRICE QTY
C01 222 ROHIT SHARMA 70000 20
C02 666 DEEPIKA KUMARI 50000 10
C03 111 MOHAN KUMAR 30000 5
C04 555 RADHA MOHAN 30000 11
91 Page 10 of 19
29. Write a function search_replace() in Python which accepts a list L of
numbers and a number to be searched. If the number exists, it is replaced
by 0 and if the number does not exist, an appropriate message is
displayed. 3
Example :
L = [10,20,30,10,40]
Number to be searched = 10
(ii) Pop_element() To pop the object from the stack and display it.
For example :
If the lists of courses details are :
3]
2]
3]
2]
3]
91 Page 11 of 19 P.T.O.
SECTION D
31. ABC Consultants are setting up a secure network for their office campus
at Noida for their day-to-day office and web-based activities. They are
planning to have connectivity between three buildings and the head office
situated in Bengaluru. As a network consultant, give solutions to the
questions (i) to (v), after going through the building locations and other
details which are given below :
BUILDING 3
Number of computers
Building Number of Computers
Building 1 25
Building 2 51
Building 3 150
Head Office 10
(i) Suggest the most suitable place to install the server for this
organization. Also, give reason to justify your suggested location. 1
(ii) Suggest the cable layout of connections between the buildings
inside the campus. 1
91 Page 12 of 19
(iii) Suggest the placement of the following devices with justification : 1
Switch
Repeater
(v) The System Administrator does remote login to any PC, if any
requirement arises. Name the protocol, which is used for the same. 1
import random
S=["Pen","Pencil","Eraser","Bag","Book"]
for i in range (1,2):
f=random.randint(i,3)
s=random.randint(i+1,4)
print(S[f],S[s],sep=":")
Options :
(I) Pencil:Book
(II) Pencil:Book
Eraser:Bag
(III) Pen:Book
Bag:Book
(IV) Bag:Eraser
91 Page 13 of 19 P.T.O.
(ii) The table Bookshop in MySQL contains the following
attributes :
B_code Integer
B_name String
Qty Integer
Price Integer
mydb=mysql.connect(host="localhost",
user="shop",passwd="Book",database="Bstore")
mycursor=__________ # Statement 1
qry= "update Bookshop set Qty=20 where
B_code=105"
___________________ # Statement 2
___________________ # Statement 3
OR
91 Page 14 of 19
(b) (i) Predict the output of the code given below : 2
text="LearningCS"
L=len(text)
ntext=""
for i in range (0,L):
if text[i].islower():
ntext=ntext+text[i].upper()
elif text [i].isalnum():
ntext=ntext+text[i 1]
else:
ntext=ntext+'&&'
print(ntext)
91 Page 15 of 19 P.T.O.
Statement 3 to read the complete result of the query into
the object named B_Details, from the table Bookshop in
the database.
mydb=mysql.connect(host="localhost",
user="shop",passwd="Book",database="Bstore")
mycursor=___________ # Statement 1
mycursor.execute("_________") # Statement 2
B_Details=__________ # Statement 3
for i in B_Details:
print(i)
33. (a) Write a point of difference between append (a) and write (w)
modes in a text file. 5
Write a program in Python that defines and calls the following
user defined functions :
(i) Add_Teacher() : It accepts the values from the user and
inserts
record consists of a list with field elements as T_id, Tname
and desig to store teacher ID, teacher name and
designation respectively.
(ii) Search_Teacher() : To display the records of all the PGT
(designation) teachers.
OR
(b) Write one point of difference between seek() and tell()
functions in file handling. Write a program in Python that defines
and calls the following user defined functions : 5
(i) Add_Device() : The function accepts and adds records of the
91 Page 16 of 19
SECTION E
Table : Salesperson
S_ID S_NAME AGE S_AMOUNT REGION
S001 SHYAM 35 20000 NORTH
S002 RISHABH 30 25000 EAST
S003 SUNIL 29 21000 NORTH
S004 RAHIL 39 22000 WEST
S005 AMIT 40 23000 EAST
91 Page 17 of 19 P.T.O.
35. Atharva is a programmer, who has recently been given a task to write a
Python code to perform the following binary file operation with the help
of a user defined function/module :
the item details stored in the binary file, items.dat, except for
the item whose item_id is 101. The data is stored in the following
format :
{item_id:[item_name,amount]}
def Copy_new():
f1=_____________ # Statement 2
f2=_____________ # Statement 3
item_detail=___________ # Statement 4
if _______________: # Statement 5
pickle.___________ # Statement 6
f1.close()
f2.close()
He has succeeded in writing partial code and has missed out certain
statements. Therefore, as a Python expert, help him to complete the code
91 Page 18 of 19
(i) Which module should be imported in the program ? (Statement 1) 1
(ii) Write the correct statement required to open the binary file
"items.dat". (Statement 2) 1
91 Page 19 of 19 P.T.O.