Вы находитесь на странице: 1из 1

MODEL PAPER : CLASS XII (CBSE)

Time: 3 hrs.

SUBJECT : COMPUTER SCIENCE

SECTION A (C++)

Q1 (a) What is typedef in context of C++. Explain with


example.
1
(b) Write the names of the header les to which
the following belong:
1
(i) setw
(ii) seekp( )
(c) Rewrite the following program after
removing the syntactical errors (if any).
Underline each correction. 3
Also give the reason of error in single line
comment where as possible.
#include<iostream.h>
Struct stu
{
int rno=3,
oat mks=50;
}
void dis(stu P)
{
cout<<rno<<mks<<endl;
}
main( )
{
stu var1=(5,77);
stu.dis(var1);
}
(d) Find the output of the following program or code
segment :
2
char str1[ ]=vanasthali,str2[ ]=school;
cout<<First result <<strcmp(str1,str2)<<endl;
int b=10;
cout<<result2
<<b++<<
<<b++<<
<<b++<< <<++b;
(e)
1
int a=32;
char ch=102, &cho=ch;
cho = a;
a=ch;
cout<<The values are as : <<a<<,<<ch;
(f)
1
#dene M(a) a*a
void main( )
{
int x=M(2+4);
cout<<the value of x is <<x;
}
(g) Observe the following program SCORE.CPP
carefully, if the value of Num entered by the user
is 6, Give all the possible output(s)
2
//program : SCORE.CPP
#include<stdlib.h>
#include<iostream.h>
void main( )
{
randomize ( );
int Num, Rndnum;
cin>>Num;
Rndnum = random (Num) + 3;
for (int N = 5; N<Rndnum; N++)
cout<<N<< ;
}
Q2 (a) What do you understand by copy
constructor? Give the example of copy
constructor through dening it within a
class. Also give the statement invoking it. 2
(b) Answer the questions (i) and (ii) after going
through the following class:
2
class seminar
{
int time;
public:
seminar( )
// Function 1
{
time=20; cout<<Seminar starts now
<<endl;
}
void lecture( )
// Function 2
{
cout<<Lectures in the Seminar on
<<endl;
}
seminar(int duration)
// Function 3
{ time=duration; cout<<Seminar starts now
<<endl;
}
~seminar( )
// Function 4
{ cout<<Vote of thanks <<endl; }
};
i) In Object Oriented Programming, which
concept is illustrated by Function 1 and
Function 3 together?
ii) Give the statement(s) invoking Function 3.
(c) Dene a class student for the following
specications.
4
Private members of the student are:
Roll_no integer
Name of type structure NAME (where the
structure
NAME is having the
members FirstName and LastName each of
characters of size 20)
Marks array of integers of size 8
Percentage oat.
Function calculate( ) returning the total percentage
of 8 marks.
Public members of the student are:
Function read( ) reading Roll_no, FirstName,
LastName, Marks, and invoke the function
calculate( ) to set the variable percentage.
Function SHOW( ) to Display the all details of
the student.
(d) Answer the questions (i) to (iv) based on the
following:
4
class A

MM: 70

{
long Cust_no;
char Cust_Name[20];
protected:
int Register(oat);
public:
CUSTOMER(long double);
char Status(char);
};
class B: public A
{
long Salesman_no;
char Salesman_Name[20];
protected:
oat Salary;
public:
SALESMAN( );
double Enter( );
int Show( );
};
class C : private B
{
char Voucher_No[10];
public:
SHOP( );
char Sales_Date[8];
oat Sales_Entry( );
char Sales_Detail( );
};
void main( )
{
C Z;
}
(i) Write the names of members which are
accessible through Z.
(ii) What type of inheritance is implemented in
the above example.
(iii) Write the names of all the data members
which are accessible from class C.
(iv) How many bytes will be required by an
object of class B and class C?
Q3.(a) Convert the following inx expression to its
equivalent postx expression.
2
A * B / ( C ^ D / E ^ F) G
(b) An array A[10][30] is stored in the memory along
the column with each of its elements occupying
4 bytes. Find out the address of an element
A[2][5], if the location A[5][10] is stored at the
address 4000.
2
(c) An array B[16][[37] is stored in memory with
each element required 4 bytes of storage. If the
base address is 3000, determine the location of
B[3][6] when the array is stored as row major. 2
(d) Given a structure named as Book having
members book id and book title. Dene a
function Bubble_Sort( ) having array of
structure Book and its the size of the array as
its argument. The function is required to sort the
array of Book in ascending order on the key:
book id using bubble sort.
3
(g) Give the necessary declaration of class for the
linked implemented stack through dening the
functions to push and pop the nodes. Each node
is containing ItemCode (int) and Price (oat) in
addition to pointer eld.
4
(h) Consider the following key set: 74, 11, 65,
58, 42, 29 use selection sort to sort the data in
ascending order and indicate the sequences of
steps required.
2
Q4 a) The le content before each time the program
is executed is the string VANASTHALI
3
(Note that are not part of the le).
void main( )
{
_______________________;
//
Statement
fobj<<MY;
fobj.seekg(0,ios::end);
cout<<Result is <<fobj.tellg( );
}
What shell be the output and what shell be the
contents of the le after execution of the above
code segment.
Consider the following cases for the
_________________//
Statement
i) fstream fobj(data.dat,ios::out | ios::in);
ii) fstream fobj(data.dat,ios::app | ios::in);
iii) fstream fobj(data.dat,ios::out);
b) Given the class TABLE below. Write the
functions in C++ to perform the following:
3
A function to write objects of TABLE to a binary
le.
Another function to read objects of TABLE from
binary le and display them.
class TABLE
{ int height;
char colour[10];
public:
void getdata( ) { cin>>height; gets(colour); }
void
showdata(
)
{
cout<<height<<
<<colour<<endl;}
};
SECTION : B (PYTHON)

Q1. a) Dene the term encapsulation. How it can be


implemented in Python. Explain using example? [2]
b) Name the function / method required to get
the position of an item in the list. Explain with
example.
[1]
c) Rewrite the following python code after
removing all syntax error(s). Underline the
corrections done.
[2]
x= randint(6,30)
if x>=10:
Print 2>8

GENERAL
INSTRUCTION

All questions are compulsory. Programming Language: Section A C+ +.


Programming Language : Section B Python.
Answer either Section A or B, and Section C is compulsory.
Write Section A C++ or Section B Python at the top of your answer sheet

x//=2
else
print pow(2,11)
x=-6
d) Give the output of following
[2]
k=[4,2,6,8,9]
m=k
m[1]=55
for a in [2,1,3]:
print m[a]
else:
print k is ,k
e) What are the possible outcome(s) expected
from the following python code? Also specify
maximum and minimum value, which we can
have.
[2]
from random import *
a=3
while a:
print int(random()*10+5),#,
a-=1
I. 1 # 6 # 11 #
II. 12 # 7 # 8 #
III. 10 # 9 # 11 #
IV. 14 # 15 # 7 #
V. 14 # 9 # 4 #
f) Illustrate the concept of inheritance with the help of
python code
[3]
Q2. a) Explain garbage collection.
[2]
b) What will following python code produce [2]
try:
print a,
statement1
except TypeError:
print b,
except ZeroDivisionError:
print c,
except:
print d,
else:
print e,
nally:
print f,
Replacing statement1 with
i) print 9/2,
ii) print 9/0,
iii) print 2+3
iv) print 7/r
Give output of each individually
c) Write a class Mouse in python with the following
specications:
[4]
Instance Attributes
SerialNo
#numeric value
Type
#String Value
Make
#String Value
Price
#Nemeric Value
Methods:
Read ( )
#A method with 4 argumets to set the
value of all of its instance variables
Dene function _ _str_ _ ( ) helping function show
( ) to display details
Show ( ) #Invoking function _ _str_ _( )
Overload the + operator returning the sum of price
of two mouse.
d) What are the different ways of overriding function
call in derived class of python? Illustrate with
example.
[2]
e) Write a python function returning the list of
composite numbers in the range 50 to 100 [2]
Q3. a) Show the steps to sort the following elements
in descending order using insertion sort method.
40, 67, -23, 11, 27, 38, -1
[2]
b) Write a python function to sort a list of integers
using selection sort method. Function should
receive the list of numbers to be sorted as its
argument.
[2]
c) Dene queue class in python to operate on queue
of numbers.
[4]
d) Write a python generator function to generate
prime numbers till the value provided as
parameter to it.
[2]
e) Evaluate the following postx expression. Show
the status of stack after execution of each
operation separately: (Hint: Ans is True/1 or
False/0)
5,10, , 2, ,11,14, , 12, * , /
[2]
f) Convert the following inx expression to postx
expression using stack. Show the status of stack
after execution of each operation:
A(B+C)/ D+EF*G
[2]
Q4.a) Differentiate between w+ and r+ modes in
python.
[1]
b) Given a pickled le - log.dat, containing
multiple strings. Write a python function that
reads the le and looks for a string of the form
Xerror: 0.2395
whenever such string is encountered, extract
the oating point value and compute the total
of these error values. When you reach end of
le print total number of such error lines and
average of error value.
[3]
c) Given a text le student.dat containing information
of students in following format
RNo, Name, Marks (i.e. each eld is separated
using , (comma))
Write a python function to display names of all
those students whose marks are above 90 also
give the average marks of all of the students who
attain marks in range 70 to 90.
[2]
SECTION : C

Q5. a. Dene the following


i) Data Manipulation Language

ii) Primary key v/s Foreign key.


[2]
b) Study the following tables DOCTOR and
SALARY and write SQL commands for the
questions i) to v) and give outputs for SQL
queries vi) and vii).
[5]
TABLE: DOCTOR

ID
101
104
107
114
109
105
117
111
130

NAME
ANKIT
SUMIT
YOGENDER
RAVI
FIZA
VIKAS
DAISY
RACHNA
SATPAL SINGH

DEPT
SEX EXPERIENCE
ENT
M
12
ORTHOPEDIC
M
5
CARDIOLOGY M
10
SKIN
F
3
MEDICINE
F
9
ORTHOPEDIC
M
10
ENT
F
3
MEDICINE
F
12
ORTHOPEDIC
M
15

TABLE: SALARY
ID BASIC
101 12000
104 23000
107 32000
114 12000
109 42000
105 18900
130 21700

ALLOWANCE
1000
2300
4000
5200
1700
1690
2600

CONSULTATION
300
500
500
100
200
300
300

i) Display name of all doctors who are in ENT


having Basic upto 21000
ii) Display the average salary of all doctors working
in ORTHOPEDIC department
(i.e. salary = BASIC + ALLOWANCE)
iii) Display the minimum ALLOWANCE of female
doctors.
iv) Display the name of the doctors ascending order.
v) Display the minimum experience mentioned in
each department.
vi) SELECT count(*) from DOCTOR where
SEX=F
[0.5]
vii)SELECT NAME, DEPT, BASIC from
DOCTOR, SALARY
where DEPT=ENT AND DOCTOR.
ID=SALARY.ID
[0.5]
Q6 a) Design a circuit to realize the following (using
basic gates):
[1]
F(A,B,C) = AB + (AB)
b) Obtain the simplied form of Boolean
Expression using Karnaugh Map.
[1]
F(x,y,z)=SOP( 0,1,2,4,5,6)
c) Obtain the simplied form of Boolean Expression
using Karnaugh Map.
[2]
F(a,b,c,d)=POS(0,1,2,8,9,10,12,14)
d) Give the canonical POS for the following
function:
[1]
F(X,Y,Z) = POS(2,3,7)
e) Give the maxterm for the following function: [1]
F(X,Y,Z) = X+Z
f) State the commutative law.
[1]
g) Draw the logic circuit to obtain NAND, using
NOR gage only.
[1]
Q7.a.Give any two advantage of using Optical
Fibers.
[1]
b. Indian School, in Mumbai is starting up the
network between its different wings. There are
Four Buildings named as SENIOR, JUNIOR,
ADMIN and HOSTEL as shown below.
[4]
SENIOR
JUNIOR
ADMIN
HOSTEL
The distance between various buildings is as follows:
ADMIN TO SENIOR 200m
ADMIN TO JUNIOR 150m
ADMIN TO HOSTEL 50m
SENIOR TO JUNIOR 250m
SENIOR TO HOSTEL 350m
JUNIOR TO HOSTEL 350m
Number of Computers in Each Building
SENIOR 130
JUNIOR 80
ADMIN 160
HOSTEL 50
(b1) Suggest the cable layout of connections
between the buildings.
(b2) Suggest the most suitable place (i.e. building)
to house the server of this School, provide a
suitable reason.
(b3) Suggest the placement of the following devices
with justication.
Repeater
Hub / Switch
(b4) The organization also has Inquiry ofce in
another city about 50-60 Km away in Hilly
Region. Suggest the suitable transmission
media to interconnect to school and Inquiry
ofce out of the following.
Fiber Optic Cable
Microwave
Radio Wave
c) Write any two importance of Cloud Computing.[1]
d) Differentiate between Proprietary Software and
FLOSS. Write names of any two popular Open
Source Software, which are used as operating
System.
[1]
e) Expend the following
[1]
i) VOIP
ii) IRC
f) Explain GPS and GPRS.
[1]
g) Which type of network (out of LAN, MAN and
PAN ) is formed, when you connect two mobiles
using Bluetooth to transfer a picture le.
[1]

Вам также может понравиться