GUESS PAPER COMPUTER SCIENCE
CLASS - XII
Time allowed: 3 hours Maximum Marks: 70
Instructions:
(i) All questions are compulsory.
(ii) Programming language: C++
(a) Write the names of the header files to which the following belong : 1
(i) isalnum( ) (ii) fabs( )
(b) What is the difference between Object Oriented Programming and
Procedural programming? 2
(c) Rewrite the following program after removing the syntactical error(s), if
any. Underline each correction. 2
struct Pixels
{
int Color, Style; }
void ShowPoint (Pixels P)
{
cout <<P.Color , P.Style<< endl;
}
void main ( )
{
Pixels Point1 = (5, 3);
ShowPoint (Point1);
Pixels Point2 = point1;
Color.Point1+ = 2;
ShowPoint(Point2);
}
(d) Give the output of the following program segment (Assume all
required header files are included in the program) 2
void main( )
{ char *NAME="cbSE eXAm";
for(int x=0;x<strlen(NAME);x++)
if(islower(NAME[x]))
NAME[x]=toupper(NAME[x]);
else
if(isupper(NAME[x]))
if(x%2!=0)
NAME[x]=tolower(NAME[x-1]);
else
NAME[x]--;
cout<<NAME<<endl; }
(e) Write the output of the following program: 3
#include<iostream.h>
int func (int &x, int y=10)
{
if(x%y==0) return ++x; else return y--;
}
void main()
{ int p=20,q=23;
q=func(p,q);
cout<<p<<” “<<q<<endl;
p=func(q);
cout<<p<<” ”<<q<<endl;
q=func(p);
cout<<p<<” “<<q<<endl;
}
(f) What will be the output of the following program: 2
#include<iostream.h>
#include<ctype.h>
#include<conio.h>
#include<string.h>
void ChangeString(char Text[], int &Counter)
{ char *Ptr = Text;
int Length = strlen (Text);
for ( ;Counter<Length-2; Counter+=2, Ptr++)
{
* (Ptr + Counter) = toupper( * (Ptr + Counter) );
}
}
void main( )
{ clrscr();
int Position = 0;
char Message[] = “Pointers Fun”;
ChangeString (Message, Position);
cout<<Message<<“ @ “<<Position;
}
2. (a) How does inheritance influence the working of constructors and
destructors? 2
(b) Define a class Serial in C++ with the following specifications: 4
Private members of class Serial
Serialcode integer
Title 20 characters
Duration float
Noofepisodes integers
Public member function of class Serial
A constructor function to initialize Duration as 30 and
noofepisodes as 10
Newserial function to accept values for serialcode and Title.
Otherenteries( ) function to assign the values of Duration and Noofepisodes with the help of corresponding values passed as parameters to this function.
Dispdata() function to display all the data members on the screen.
(c) Consider the following declarations and answer the questions given
below: 4
class vehicle { int wheels;
protected:
int passanger;
public:
void inputdata(int,int);
void outputdata(); };
class heavy_vehicle : protected vehicle
{ int diesel_petrol;
protected:
int load;
public:
void readdata(int,int);
void writedata(); };
class bus : private heavy_vehicle
{ char make[20];
public:
void fetchdata(char);
void displaydata(); };
(i) Name the base class and derived class of the class heavy_vehicle.
(ii) Name the data member(s) that can be accessed from function
displaydata.
(iii) Name the member function(s) that can be accessed by an object of bus
class.
(iv) Is the member function outputdata accessible to the objects of
heavy_vehicle class?
(d) Answer the questions (i) and (ii) after going through the following class. class Exam 3
{ char Subject[20] ;
int Marks ;
public :
Exam( ) // Function 1
{ strcpy(Subject, “Computer” ) ;
Marks = 0 ; }
Exam(char P[ ]) // Function 2
{ strcpy(Subject, P) ;
Marks=0 ; }
Exam(int M) // Function 3
{ strcpy(Subject,”Computer”) ;
Marks = M ; }
Exam(char P[ ], int M) // Function 4
{ strcpy(Subject, P) ;
Marks = M ; }
};
(i) Which feature of the Object Oriented Programming is demonstrated using Function 1, Function2, Function 3 and Function 4 in the above class Exam?
(ii.) Write statements in C++ that would execute Function 3 and
Function 4 of class Exam.
3 (a) Write a program to read an array of N positive integers. Define a
function shift() to shift all odd elements towards left and even to right
without changing order of numbers. 4
If input: 1,5,7,8,9,2,10
Output: 1,5,7,9,8,2,10.
(b) Translate, following infix expression into its equivalent postfix
expression ((A-B)*(D/E))/(F*G*H) 2
(c) Each element of an array A[-20..20,10..35] requires one byte of storage.
If the array is stored in column major order beginning location 500,
determine the location of A[0,30]. 2
(d) Write a function in C++ to perform Push operation on a dynamically
allocated Stack containing real numbers. 4
(e) Write a function in C++ to find the sum of diagonal elements from a
two dimensional array of type float. Use the array and its size as
parameters with float as its return type. 2
4 (a) Write a user defined function in C++ to read the content from a text file
NOTES.TXT, count and display the number of blank spaces present in
it. 3
(b) Observe the program segment given below carefully, and answer the
question that follows : 1
class Member
{
int Member_no;
char Member_name[20];
public :
void enterdetails{) ;
void showdetails();
int RMember_no() {return Member_no; }
};
void Update(Member NEW)
{
fstream File;
File.open(“MEMBER.DAT”,ios::binary|ios::in|ios::out);
Member OM;
int Recordsread = 0, Found = 0;
while (!Found && File.read((char*)&OM, sizeof(OM)))
{
Recordsread ++;
if (NEW.RMember_no() == OM.RMember_no())
{
___________________//Missing Statement
File.write((char*)&NEW, sizeof(NEW));
Found = 1;
}
else
File.write((char*)&OM, sizeof(OM));
}
if (!Found)
cout<<“Record for modification does not exist”;
File.close();
}
If the function Update ( ) is supposed to modify a record in file
MEMBER.DAT with the values of Member NEW passed to its
argument, write the appropriate statement for Missing Statement using
seekp( ) or seekg( ), whichever needed, in the above code that would
write the modified record at its proper place.
(c) Assuming the class DRINKS defined below, write functions in C++ to perform the following: 3
(i) Write the objects of DRINKS to a binary file.
(ii) Read the objects of DRINKS from binary file and display them on screen when DNAME has value "INDY COLA".
class DRINKS
{ int DCODE;
char DNAME[13]; //Name of the drink
int DSIZE; //Size in liters float DPRICE;public:
void getdrinks( )
{cin>>DCODE>>DNAME>>DSIZE>>DPRICE;}
void showdrinks( )
{cout<<DCODE<<DNAME<<DSIZE<<DPRICE<<endl;}
char *getname( ){return DNAME;} };
5. (a) What do you understand by the terms Candidate Key and Cardinality
of a relation in relational database ? 2
(b) Write SQL commands for (b) to (e) and write the outputs for (g) on the
basis of table CLUB. 6
Table: CLUB
COACH_ID |
COACHNAME |
AGE |
SPORTS |
DATOFAPP |
PAY |
SEX |
1 |
KUKERJA |
35 |
KARATE |
27/03/1996 |
1000 |
M |
2 |
RAVINA |
34 |
KARATE |
20/01/1998 |
1200 |
F |
3 |
KARAN |
34 |
SQUASH |
19/02/1998 |
2000 |
M |
4 |
TARUN |
33 |
BASKETBALL |
01/01/1998 |
1500 |
M |
5 |
ZUBIN |
36 |
SWIMMING |
12/01/1998 |
750 |
M |
6 |
KETAKI |
36 |
SWIMMING |
24/02/1998 |
800 |
F |
7 |
ANKITA |
39 |
SQUASH |
20/02/1998 |
2200 |
F |
8 |
ZAREEN |
37 |
KARATE |
22/02/1998 |
1100 |
F |
9 |
KUSH |
41 |
SWIMMING |
13/01/1998 |
900 |
M |
10 |
SHAILYA |
37 |
BASKETBALL |
19/02/1998 |
1700 |
M |
(i) To list names of all the coaches with their date of appointment (DATOFAPP) in descending order.
(ii) To display a report showing coachname, pay, age, and bonus (15% of pay) for all the coaches.
(iii) Give the output of the SQL statement: Select AVG(PAY) from
CLUB where SPORTS="KARATE";
6 (a) State and verify De-Morgan’s law in Boolean Algebra. 2
(b) Draw the circuit diagram for F = AB’C + C’B using NAND to
NAND logic only. 2
(c) Write the Sum of Products form of the function G(U,V,W). Truth table representation of G is as follows: 1
U |
V |
W |
G |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
0 |
1 |
0 |
1 |
1 |
1 |
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 : 3
F (A, B, C, D) = ? ? (0, 1, 2, 3, 4, 5, 10, 11, 15)
7 (a) Write two disadvantages for STAR topology. 1
(b) Write the difference between coaxial and optical fiber cable. 1
(c) Explain the following terms in short : 1
(i) GSM ii) CDMA
(d) Define Packet Switching. 1
(e) East and West Public Ltd. has decided to network all its offices spread
in five buildings of C.P. (Shown below).
The distance between buildings are given below:
Between 1 & 2 |
20 Mts |
Between 3 & 5 |
70 Mts |
|
Between 2 & 3 |
50 Mts |
Between 1 & 5 |
65 Mts |
|
Between 3 & 4 |
120 Mts |
Between 2 & 5 |
50 Mts |
|
Between 4 & 5 |
30 Mts |
(i) Suggest cable layout(s) for connecting the buildings. 1
(ii) Suggest the most suitable building to install the server of
this organization with a suitable reason, with justification. 1
(iii) Building3 is used for many critical operations. It is tried that
PC gets maximum possible bandwidth. Which network
device is/should be used for this? 1
(iv) The company also has another office in the same city but at a
distant location about 25-30 kms away. How can link be
established with this building. 1
(i.e. suggest the transmission medium).
Download Guess Paper Economics Class XII(12th) 2007
- Geography - 1998
(438 downloads)