Professional Documents
Culture Documents
REGION
THIRD PRE-BOARD EXAMINATION 2015 FOR CLASS XII
Subject: Computer Science
Max Marks: 70
GENERAL INSTRUCTIONS:
1. All questions are compulsory
2. Programming Language : C++
Time: 3Hrs
1. (a) Differentiate between call by value and call by reference with suitable
example.
(2)
(b) Which C++ header files are required for the following program code to
execute?
(Note: do not include any header file which are not required)
(1)
void main()
{
cout<<Square root of 625 is: <<sqrt(625);
}
(c) Rewrite the following program after removing the syntax errors. Underline
each correction. (2)
#include<iostream.h>
#include<conio.h>
class Exam
{
char NameOfExam[20];
int Year;
public
void getexamdetails()
{
cout<<"Enter name of the exam: ";
gets(NameOfExam);
cout<<"Enter year of exam: ";
cin>>Year;
}
void showexamdetails()
{
cout<<NameOfExam<<"\n<<Year;
}
}
void main() {
1
Exam E1;
getexamdetails();
showexamdetails();
}
(d) Observe the following C++ code carefully and write output.
(2)
#include<iostream.h>
#include<string.h>
int main()
{
char *STR="AeroDynamics";
int A=1;
STR+=3;
while(A<9)
{
cout<<*STR<<strlen(STR)<<"\n";
STR++;
A=A+2;
}
return 0;
}
(e) Write output for the following program.
(3)
#include<iostream.h>
#include<conio.h>
struct ITEM
{
int ICode , Qty;
};
void assigndetail( ITEM & I, int Q=5)
{
I.ICode++;
I.Qty*=Q;
}
void main()
{
clrscr();
ITEM T={200,25};
assigndetail(T,10);
cout<<T.ICode<<":"<<T.Qty<<"\n";
assigndetail(T);
cout<<T.ICode<<":"<<T.Qty<<"\n";
assigndetail(T,6);
cout<<T.ICode<<":"<<T.Qty<<"\n";
2
getch();
}
(f) Study the following program carefully and select the option which is NOT a
possible output.(2M)
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
const int VALUE=15;
int main()
{
clrscr();
int INCR=5;
randomize();
for(int i=1;i<5;i++)
{
int bid=VALUE+random(INCR);
cout<<bid<<":";
INCR+=2;
}
getch();
return 0;
}
(i)
16:19:22:25:
(ii)
19:16:15:24:
(iii) 15:18:20:16:
(iv) 18:22:23:19:
2. (a) What is function overloading? Explain with a suitable example.
(2)
(b) Study the following program code and answer the questions given below.
class TIME
{
int Hrs,Min,Sec;
public:
TIME(){Hrs=Min=Sec=0;}
//Function 1
TIME(int H,int M,int S)
//Function 2
{
Hrs=H;
Min=M;
Sec=S;
}
TIME(TIME & T);
//Function 3
~TIME(){ }
//Function 4
};
3
(i)
(ii)
void Compute();
public:
FACTORY();
void Enter();
void Show(); };
class SHOP: private COMPANY
{
char Location[20];
float Area;
double Sale;
public:
SHOP();
void Input();
void Output();
};
(i)
(ii)
(iii)
(iv)
3. (a) Write a function voidmodifylist( int A[], int Size) in C++ , which modifies
the elements present
in an array in such a way that the elements, which are multiples of 7 swap with
the value
present in the very next position in the array.
(3)
For example:
If the content of the array A is
42, 12, 57, 63, 25, 78
The content of the array should become
12, 42, 57, 25, 63, 78
(b) An array S[30][20] is stored in the memory along the row with each of the
element occupying 2 bytes .find out the memory location for the element S[15]
[10] , if the base address of the array
is 3200.
(3)
(c) Write a function void showabove(int A[4][4], int R, int C)to display all the
elements above the
Right Diagonal in a 2D array.
(2)
(d) Evaluate the following postfix stack notation of expression:
(2)
6,7,+,4,*,32,-,5,/
#include<fstream.h>
class Movie
{
char moviename[25];
char actorname[25];
public:
int count(); // A function to count no.of records
};
int Movie:: count()
{
fstream file;
file.open(Movie.DAT,ios::binary| ios::in);
.. //Statement1
intTotalbytes= .. //Statement2
int number_of_records=Totalbytes / sizeof(Movie);
file.close();
return number_of_records;
}
(b) Write a function in C++ to count the number of lowercase alphabets present
in a text file BOOK.TXT.
(2)
(c) Assume the class STUDENT as declared below
class STUDENT
{
char name[20];
int std;
char schoolname[20];
int age;
public:
void register();
void show();
int get_std();//returns std;
};
Write a function BACKUP() in C++, that would copy only those records
having std as12 from
STUDENT.DAT to STUDENTBACK.DAT.
(3)
VinayKatiyar
Ritesh
Abhinav
Dharaneedhar
Manoj
DESIGNATION PLEVE
L
Supervisor
P001
Operator
P003
Operator
P003
Mechanic
P002
Clerk
P002
DOJ
DOB
13-Sep-2004
22-Feb-2006
14-May-2009
21-Apr-2008
22-Dec-2009
23-Aug-1981
12-July-1987
14-Oct-1983
21-Nov-1985
24-Jun-1984
Table: PAYLEVEL
PLEVEL
P001
P002
P003
PAY
26000
24000
18000
ALLOWANCE
12000
10000
6000
1)
Q
0
R
0
7
G
0
0
0
0
1
1
1
1
0
1
1
0
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
(d)
7. (a) Differentiate between Bus and Star topology with a neat diagram.
(2)
(b)
Expand the following:
(2)
(i) GSM
(ii) CDMA
(iii)
WLL
(iv)
SMTP
(c)
Knowledge Supplement Organization has set up its new centre at
Mangalore for its office and
web based activities. It has four buildings Alpha, Beta, Gamma, Lambda.
Answers questions
(i)to (iv) based on data given.
Center to center distance between various buildings
Number of Computers
Alpha to Beta
50m
Alpha
25
Beta to Gamma
150m
Beta
50
Gamma to Lambda
25m
Gamma
125
Alpha to Lambda
170m
Lambda
10
Beta to Lambda
125m
Alpha to Gamma
90m
i)
(d)
(e)
(1)
ii)
Suggest the most suitable place (i.e. building) to house the server of
this organization with a suitable reason.
(1)
iii)
iv)
The organization is planning to link its front office situated in the city
in a hilly region where cable connection is not feasible, suggest an
economic way to connect it with reasonably high speed?
(1)
Give any two examples for Open Source Software.
(1)
What is protocol?
**************