Sunteți pe pagina 1din 7

SAMPLE PAPER-1

COMPUTER SCIENCE (Theory)


Class-XII
Time Allowed: 3hours

Maximum Marks: 70

Ques. 1.
a) Differentiate between Run Type and Syntax error with example.[2]
b) Name the header files that shall be needed for the successful
execution of following code:
[1]
void main()
{char Word[]=Exam;
cout<<setw(20)<<Word;
}
c) Rewrite the following program after removing syntactical error(s)
if any and underline each correction:
[2]
#include iostream.h
class MEMBER
{ int Mno; float Fees;
PUBLIC:
void Register ()
{ cin>>Mno>>Fees; }
void Display()
{ cout<<Mno<<" : "<<Fees<<endl; }
};
void main()
{
MEMBER delete;
Register();
delete.Display();
}
d) Give the output of the following program segment:
void main()
{
char *NAME=No ExPeRt!;
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) Find the output of the following program:
#include<iostream.h>
void Withdef(int HisNum=65)
{
for(int I=40;I<=HisNum;I+=5)
cout<<I<<,;
cout<<endl;
}
void Control(int &MyNum)

[2]

[3]

MyNum+=40;
Withdef(MyNum); }
void main()
{
int YourNum=10;
Control(YourNum);
Withdef();
cout<<Number=<<YourNum<<endl;
}
f) In the following program, find the correct possible output(s) from
the options. Justify your answer.
[2]
#include<iostream.h>
#include<stdlib.h>
void main( )
{
randomize();
int p=99,q=999;
int x=random(3)+4;
int y=random(2)+2;
for(int i=0;i<x;i++)
cout<<#;
cout<<p<<-;
for(i=0;i<y;i++)
cout<<@;
cout<<q<<endl;
}
i- ##99-@999
ii- ##99-@@999
iii- ######99-@@999
iv- ####99-@@@
Ques.2.

a) What is the difference between constructor & destructor


functions ? Support your answer with example.
[2]

b) Write the output of the following C++ code. Also,name the feature
of OOP jointly illustrated by the functions (i) to (iv):
[2]
#include <iostream.h>
void Line( )
//Function i
{
for (int L=1; L<=80; L++) cout<<-;
cout<<endl;
}
void Line(int N)
//Function ii
{
for(int L=1; L<=N; L++) cout<<*
cout<<endl;
}
void Line(char C, int N)
//Function iii
{
for(int L=1;L<=N;L++) cout<<C;
cout<<endl;
}
void Line(int M, int N)
//Function iv
{
for(int L=1; L<=n;L++) cout<<M*L;
cout<<endl;
}
void main()
{
int A=9,B=4,C=3;
char K=#;
Line(K,B);

Line(A,C);
}
c) Define a class STATE in C++ with following description :
Private members :
[4]
Name of state (type string)
Population (long int)
Number of girls under 16 years of age attending school (long int)
Total number of girls under 16 years of age (long int)
A member function CALC_PER( ) to calculate & return the
percentage of girls attending the school as ( Number of girls
attending the school/Total number of girls * 100 )
Public members :
A constructor to initialize name of the state as NOT ALLOTTED
A function INSTATE() to enter data for all data members
A function OUTSTATE( ) to view the contentS of all the data
members along with the percentage of girls attending the school.
d) Read the following class declaration and answer the questions from
(i) to (iv) :
[4]
class Kitchen_Products
{ char Model_No[15], C_Name[30]; int year;
protected : auto float marks;
public:
void Get_It( );
void Show_It( );
};
class Fridge: public Kitchen_Products
{ protected:
int Capacity;
long Price;
char Color[12];
public:
void Read_It( );
void Print_It( );
};
class Stock : protected Fridge
{
int Stock_In_Hand;
public:
int Sold_Num;
void Get_Data( );
void Dis_Data( );
}FRIDGE;
void main( )
{ . . .
}
i)
ii)

What is the size of the object FRIDGE in number of Bytes?


What are the data members directly accessible by the object
FRIDGE?
iii) What are the members functions inherited into the class Stock?
iv) Define the function Get_Data() to input data members of object
FRIDGE.
QUES.3. a)Write a function in C++ to merge the contents of two arrays in

descending order, where array A is arranged in ascending order and


array B is arranged in descending order.
[3]
b) An arry X[20][10] is stored with each element requiring 4 bytes of
storage. If the base address of X is 4500 ,find out the memory location
of X[12][8] and X[2][4] if the content is stored along the row.
[3]
c) Evaluate the following postfix expression using stack and show stack
status
10,30,20,+,50,40,-,*,/
[2]
d) Write a function in C++ which accepts a 2D array of integers and its
size as arguments and displays the sum of boundary elements of the
array.
[2]
2 3 4 5
6 7 3 2
2 2 2 2
Output :- Sum is : 30
e) Write a function QDel() in C++ to display and delete an element from
a dynamically allocated Queue containing nodes of the following given
structure:
[4]
struct Node
{ int itemno;
char itemname[20];
Node *link; };
QUES.4. a) Observe the program segment given below and fill the gaps as
statement1 and statement2 using seekg() and tellg() functions.
[1]
# include<fstream.h>
class emp
{
int en; char Ename[20];
public:
int ctr();
};
int emp :: ctr ()
// to count the no of records in the file
{
fstream File;
File.open(EMP.DAT, ios: : binary | ios : : in);
_______________
// statement 1
int bytes =____________ // statement 2
int count =bytes /sizeof(emp);
File .close();
return count; }
b) Assume that a text file named TEXT1.TXT already contains some text
written into it. Write a function named vowelwords() that reads the file
TEXT1.TXT and create a new file TEXT2.TXT which shall contain only those
words from file TEXT1.TXT which dont start with an uppercase vowel. [2]
c) Write a function in C++ to search and display details of all trains,
whose source is Lucknow from a binary file TRAIN.DAT. Assuming the
binary file is containing the objects of the following class:
[3]
class TRAIN
{ int Tno; // Train Number
char src[20]; // Train Starting Point
char dest[20] //Train destination
public:
char *getfrom() { return src;}
char *getto()
{ return dest; }

void In()
{ cin>>Tno; gets(src); gets(dest); }
void Show()
{ cout<<Tno<<:<<src <<: <<dest<<endl; }};
QUES.5.
a) What do you mean by Projection in RDBMS? Explain by example.

[2]

b)Study the following tables MEMBERS and SALARY and write SQL commands
for the questions (i)-(iv) and give outputs for SQL queries (v)-(vi):[6]
TABLE: MEMBERS

TABLE:

ID

BASIC

ALLOWANCE

COMMISSION%

101

12000

1000

104

23000

2300

107

32000

4000

114

12000

5200

10

109

42000

1700

20

105

18900

1690

130

21700

2600

30

SALARY

i. Display ENAME of all MEMBERS who are in SALES having


more than 10 years experience from the table MEMBERS.
ii. Display the average salary of all MEMBERS working in
FINANCE department using the tables MEMBERS and
SALARY, where SALARY = BASIC + ALLOWANCE.
iii. Display the minimum ALLOWANCE of female MEMBERS.
iv. Display the highest commission% among all male MEMBERS.
v. SELECT count (*) from MEMBERS where SEX = F.
vi. SELECT ENAME, DEPT, BASIC from MEMBERS, SALARY where DEPT
= SALES and MEMBERS.ID = SALARY.ID.

vii. SELECT DEPT,BASIC, ALLOWANCE FROM members, salary WHERE


MEMBERS.ID=SALARY.ID.
viii. SELECT ENAME,DEPT,SEX FROM MEMBERS WHERE DEPT=RESEARCH;
Q6.a) Verify

XY + X.Y + XY = (X+Y) using truth table.

[2]

b) Draw the equivalent logic circuit diagram for the following Boolean
Expression using NAND gates only: XY + XZ
[2]
c) Write the POS form of a Boolean function H, which is represented in a
truth table as follows:
[1]
A B C H
0 0 0 0
0 0 1 1
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 KMap:
[3]
F(P,Q,R,S) = (1,2,3,5,6,7,9,11,12,13,15)
Q 7. a) What are firewalls?

[1]

b) Expand the following terminology i) DHTML ii) W3C

[1]

C) What are the advantages of optical fibres?

[1]

d) Explain the function of Gateway and Bridge?

[2]

e) Differentiate between HTTP & FTP?

[1]

f) Laxmi Marketing Ltd. has four branches in Rajasthan at Udaipur, Kota,


Jodhpur and Ajmer.Laxmi Marketing Ltd. wants to establish the networking
between all the four offices. A rough layout of the same is as follows:
[4]

Jodhpur office
office

Udaipur office
kota office

Ajmer
office

Approximate distances between these offices as per network survey team


are as follows:
Udaipur to Jodhpur
Jodhpur to Kota
Kota to Ajmer

30 m
40 m
25 m

Udaipur to Ajmer
Jodhpur to Ajmer
Udaipur to Kota
In continuation of the above,
install the following number of
Udaipur
40
Jodhpur
80
Kota
200
Ajmer
60

150 m
105 m
60 m
the company experts have planned to
computers in each of their offices:

i). Suggest cable layout for connecting the offices.


ii). In each of the office the management wants that each LAN segments
gets a dedicated bandwidth i.e., bandwidth must not be shared. How can
this be achieved?
iii). Where would you suggest the placement of server?
iv). The company wants to link its head office in Udaipur to its office
in London.
1. Which type of transmission medium is appropriate for such a
link?
2. What type of network would this connection result into?
*********

S-ar putea să vă placă și