Cbse Question Paper Computer Science 2011
Cbse Question Paper Computer Science 2011
Cbse Question Paper Computer Science 2011
www.cppforschool.com
COMPUTER SCIENCE-2011
Time allowed : 3hours] [Maximum Marks :70
Instructions (i) All questions are compulsory
(ii) Programming Language : C++
1. (a) What is the difference between Local Variable and Global Variable ? Also,
give suitable C++ code to illustrate both. 2
(b) Write the names of the header files, which is/are essentially required to
run/execute the following C++ code: 1
void main ()
{
char C, String [] = Excellence Overload;
for (int I=0; String [I] ! = \0;I++}
if (String [I] == )
cout<<endl;
else
{
C=toupper(String [I]);
cout<<C;
}
}
(c) Rewrite the following program after removing the syntactical errors (if any).
Underline each correction. 2
#include [iostream.h]
typedef char Text (80);
void main ()
{
Text T=Indian;
int Count=strlen(T);
cout<<T<<has<<Count<<characters<<endl;
}
(d) Find the output of the following program: 3
# include <iostream.h>
void ChangeArray (int Number, int ARR[], int Size)
{
for (int L=0; L<Size; L++)
If (L<Number)
2
www.cppforschool.com
ARR[L] + = L;
else
ARR[L] * = L;
}
void Show(int ARR [], int Size)
{
for (int L=0; L<size; L++)
(L%2!=0) ? cout<<ARR[L] <<# : cout<<ARR[L] <<endl;
}
void main ( )
{
int Array [] = {30,20,40,10,60,50};
ChangeArray (3, Array, 6);
Show (Arry,6);
}
(e) Find the output of the following program: 2
# include <iostream.h>
void main ( )
{
int Track [] = {10,20,30,40,}, *Striker ;
Striker=Track ;
Track [1] + = 30 ;
cout<<Striker><<*Striker<<endl ;
* Striker - =10 ;
Striker++;
cout<<Next @<<*Striker <<endl ;
Striker+=2 ;
cout<<last @<<*Striker<<endl ;
cout<<Reset To <<Track [0] <<endl ;
}
(f) Go through the C++ code shown below, and find out the possible output or
output from the suggested output options (i) to(iv). Also, write the least
value and highest value, which can be assigned to the variable guess. 2
# include <iostream.h>
#include <stdlib.h>
void main ( )
{
randomize ();
int Guess, High=4 ;
Guess=random (High) +50;
for (int C=guess ; C<=55 ; C++)
cout<<C<<#;
3
www.cppforschool.com
}
(i) 50 # 51 # 52 # 53 # 54 # 55 #
(ii) 52 # 53 # 54 # 55 #
(iii) 53 # 54 #
(iv) 51 # 52 # 53 # 54 # 55
2. (a) Differentiate between members, which are present within the private visibility
mode with those which are present within the public visibility modes. 2
(b) Write the output of the following C++ code. Also, write the name of feature of
Object Oriented Programming used in the following program jointly illustrated by
the functions [I] to [IV]. 2
#include<iostream.h>
void Print ( ) // Function [I]
{
for (int K=1;K<=60; K++) cout<< -;
cout<<endl;
}
void Print (int N) //Function[II]
{
for (int K=1;K<=N; L++) cout<<*;
cout<<endl;
}
void Print(int A, int B) //Function[III]
{
for(int K=1;K<=B;K++) cout<<A*k;
cout<<endl;
}
void Print(char T, int N) // Function[IV]
{
for (int K=1;k<=N;K++) cout<<T;
cout<<endl;
}
void main( )
{
int U=9,V=4,W=3;
char C =@;
Print(C,V);
Print(U,W);
}
(c) Define a class candidate in C++ with following Description:
Private Members 4
A data member RNo (Registration Number) of type long
A data member Name of type string
4
www.cppforschool.com
A data member Score of type float
A data member Remark of type string
A member function AssignRem( ) to assign Remarks as per the Score
obtained by a candidate. Score range and the respective Remarks are
shown as follows:
Score Remarks
>=50 Selected
less than 50 Not selected
Public members
A function ENTER( ) to allow user to enter values for RNo, Name, Score
& call function AssignRem() to assign the remarks.
A function DISPLAY( ) to allow user to view the content of all the data
members.
(d) Answer the question (i) to (iv) based on the following: 4
class Student
{
int Rno;
char Name[20];
float Marks;
protected:
void result( );
public:
Student ( );
void Register ( ); void Display( );
};
class Faculty
{
long FCode;
char FName [20];
protected:
float Pay;
public:
Faculty ( );
void Enter( );
void Show( );
};
class Course: public Student, private Faculty
{
long CCode [10]; char CourseName [50];
5
www.cppforschool.com
char StartDate [8], EndDate [8];
public:
Course( );
void Commence ( );
void CDetail ( );
};
(i) Which type of inheritance is illustrated in the above C++ code?
(ii) Write the names of all the data members, which is /are accessible from
member function Commence of class Course.
(iii) Write the names of member functions, which are accessible from objects of
class Course.
(iv) Write the names of all the members, which are accessible from objects of
class faculty.
3. (a) Write a Get1From2( ) function in C++ to transfer the content from two arrays
FIRST[ ] and SECOND[ ] to array ALL[ ]. The even places (0, 2, 4,) of array
ALL[] should get the content from the array FIRST[ ] and odd places (1,3,5,)
of the array ALL [ ]should get the content from the array SECOND[ ] . 3
Example:
If the FIRST[ ] array contains
30, 60, 90
And the SECOND[ ] array contains
10, 50, 80
The ALL[ ] array should contain
30, 10, 60, 50, 90, 80
(b) An array P[20] [50] is stored in the memory along the column with each of its
Element occupying 4 bytes, find out the location of P[15] [10], if P[0][0] is stored
at 5200. 3
(c) Write a function in C++ to Perform insert operation on a dynamically
allocated Queue containing Passenger details as given in the following
definition of NODE. 4
struct NODE
{
long Pno; //passenger number
char Pname[20]; //passenger name
NODE *Link;
};
6
www.cppforschool.com
(d) Write a COLSUM ( ) function in C++ to find sum of each column of each
column of a NxM matrix. 2
(e) Evaluate the following postfix notation of expression :
50, 60, +,20, 10, -, * 2
4. (a) Observe the program segment given below carefully and fill the blanks
marked as Statement 1 and Statement 2 using seekg( ), seekp( ), tellp( ) and tellg()
functions for performing the required task. 1
# include <fstream.h>
class PRODUCT
{
int Pno; char pname [20]; int qty;
public :
:
void ModifyQty ( ); // The function is to modify quantity of a
PRODUCT
};
void PRODUCT :: ModifyQty ( )
{
fstream Fil;
Fil.open (PRODUCT.DAT , ios : : binary | ios : : in | ios : : out);
int MPno;
cout<<Product No to modify quantity :; cin>>MPno;
while( Fil.read ((char*) this, sizeof (PRODUCT)))
{
if (MPno ==Pno)
{
cout<<present quantity: <<Qty<<endl;
cout<<changed quantity:; cin>>Qty;
int position = ________; //Statement 1
___________________; //Statement 2
Fil.write ((char*) this, sizeof (PRODUCT)); // Re-writing
the Record
}
}
Fil.close( );
}
(b) Write a function in C++ to count the no. of Me or My words present in a
text file DIARY.TXT. 2
If the file DIARY.TXT content is as follows :
My first book was Me and My
family. It gave me chance to be
7
www.cppforschool.com
known to the world.
The output of the function should be
Count of Me/ My in file : 4
(c) Write a function in C++ to search for a laptop from a binary file
LAPTOP.DAT containing the objects of class LAPTOP (as defined below).
The user should enter the Model No and the function should search and
display the details of the laptop. 3
class LAPTOP
{
long ModelNo;
float RAM, HDD;
char Details[120];
public:
void StockEnter ( ) {cin>>Model No>>RAM>>HDD; gets(Details);}
void StockDisplay( ){cout<<ModelNo<<RAM<<HDD<<Details<<endl;}
long ReturnModelNo ( ) { return ModelNo ;}
};
5. (a) What do you understand by Union & Cartesian Product operations in
relational algebra? 2
Consider the following tables WORKER and PAYLEVEL and answer (b) and (c)
parts of this question:
Table: WORKER
ECODE NAME DESIG PLEVEL DOJ DOB
11 Radhe Shyam Supervisor P001 13-Sep-2004 23-Aug-1981
12 Chander Nath Operator P003 22-Feb-2010 12-Jul-1987
13 Fizza Operator P003 14-Jun-2009 14-Oct-1983
15 Ameen Ahmed Mechanic P002 21-Aug-2006 13-Mar-1984
18 Sanya Clerk P002 19-Dec-2005 09-Jun-1983
Table: PAYLEVEL
PLEVEL PAY ALLOWANCE
P001 26000 12000
P002 22000 10000
P003 12000 6000
(b) Write SQL commands for the following statements: 4
(i) To display the details of all WORKERs, descending order of DOB.
(ii) To display NAME and DESIG of those WORKERs whose PLEVEL is
either P001 or P002.
8
www.cppforschool.com
(iii)To display the content of all the WORKERs table, whose DOB is in
between 19-JAN-1984 and 18-JAN-1987.
(iv) To add a new row with the following :
19, Days Kishore, Operator, P003. 19-Jun-2008, 11-Jul-1984
(c) Give the output of the following SQL queries : 2
(i) SELECT COUNT (PLEVEL), PLEVEL FROM WORKER GROUP
BY PLEVEL;
(ii) SELECT MAX(DOB), MIN(DOJ) FROM WORKER;
(iii) SELECT Name, Pay FROM WORKER W, PAYLEVEL P WHERE
W.PLEVEL = S.PLEVEL AND P.ECODE<13;
(iv) SELECT PLEVEL, PAY+ALLOWANCE FROM PAYLEVEL
WHERE PLEVEL = P003;
6. (a) Verify the following using Truth Table 2
U.(U + V) = (U+V)
(b) Write the equivalent Boolean Expression for the following Logic Circuit.
2
(c) Write the POS form of a Boolean function F, which is represented in a truth
table as follows: 1
A B C D
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
(d) Reduce the following Boolean Expression using K-Map :
F(P, Q, R, S) = (0, 1, 2, 4, 5, 6, 8, 12) 3
9
www.cppforschool.com
7. (a) Differentiate between packet switching and message switching technique in
network communication. 1
(b) Differentiate between BUS and STAR topology of networks. 1
(c) What is VoIP ? 1
(d) Out of the following, identify client side script(s) and server side script(s).
(a) ASP (b) Javascript 1
(c) VBscript (b) JSP
(e) Quick Learn University is setting up its Academic blocks at Prayag Nagar and
planning to set up a network. The university has 3 academic blocks and one
Human Resource Center as shown in the diagram below : 4
Center to center distances between various block/center is as follows :
Law Block to Business Block 40 m
Law Block to Technology Block 80 m
Law Block to HR Center 105 m
Business Block to Technology Block 30 m
Business Block to HR Center 35 m
Technology Block to HR Center 15 m
Number of Computers in each of the Blocks / Center is follows :
Law Block 15
Technology Block 40
HR Center 115
Business Block 25
(e1) Suggest the most suitable place (i.e. Block / Center) to install the server of
this university with a suitable reason.
(e2) Suggest an ideal layout for connecting these blocks/center for a wired
connectivity.
(e3) Which device you will suggest to be placed/ installed in each of these
blocks/center to efficiently connect all the computers with in these blocks / center.
10
www.cppforschool.com
(e4) The university is planning to connect its admission office in the closest big
city, which type of network out of LAN, MAN or WAN will be formed? Justify
your answer.
(f) Which of the following will come under Cyber Crime?
i. Theft of a brand new sealed pack laptop
ii. Access to a bank account for getting unauthorized Money Transaction
iii. Modification in a company data with unauthorized access
iv. Photocopying a printed report
(g) Compare open source software and proprietary software.
_______________________
www.cppforschool.com