Write Instructions Here. Write The Question Here Mark S 1 - A - 2 B 1 C 2

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

KENDRIYA VIDYALAYA SANGATHAN, CHANDIGARH REGION

TIME : 03.00
CLASS – XII – COMP.SC M.M.: 70
HRS
Write Instructions here.

Write the Question here Mark


s
1 a Differentiate between call by value and call by reference, giving suitable 2
. . example
b Name the header file(s) to which the following belongs 1
(i) abs (ii) strlen()
c Rewrite the following program after removing the syntactical error(s) if any. 2
Underline each correction.
& include <iostream.h>
void main ( )
{
int max=10;
int Numbers [Max];
for (Loc= Max-1 ; Loc > = 0 ; Loc - -)
cin>>number(loc);
for (Loc= Max-1 ; Loc > = 0 ; Loc - -)
cout>>Numbers [Loc];
}

d )#include<iostream.h> 2
int recs(int);
void main(0
{
clrscr();
int r;
for(int i=0;i<5;i++)
{
r=recs(i);
cout<<”\n”<<i<<”\t”<<r;
}
}
int recs(int num)
{
if(num==0)
return(0);
else
return(num+recs(num-1));
}

e )#include<iostream.h> 3
#include<ctype.h>

typedef char str80[80]


void main()
{
char *notes;
str80 str=”vR2GooD”;
int L=6;
notes=str;
While(L>=3)
{
str[L]=(isupper(str[L])?tolower(Str[L]):toupper(str[L]));
cout<<notes<<endl;
L--;
notes++;
}
}

f In the following program, if the value of N given by the user is 30, what 2
maximum and
minimum value the program could possibly display ()?
#include<iostream.h>
#include<stdlib.h>
void main( )
{
int N, Guessme;
randomize( );
cin >> N;
Guessme = random(N-10) + 10 ;
cout<<Guessme<<endl;
}

2 a Differentiate between private and public visibility modes function in 2


. . context of Classes and Objects using C++
b Answer the questions (i) and (ii) after going through the following class
. class Interview
{
int Month;
public:
interview(int y )(month=y;} //constructor 1
interview(interview &t); //constructor 2
};
(i) Create an object, such that it invokes constructor 1
(ii) Write complete definition for constructor 2

c Define a class Travel in C++ with the following description: 4


Private Members:
Travelcode of type long
Place of type character array (string)
No_of_travellers of type integer
No_of_buses of type integer

Public Members:
A constructor to assign initial values of TravelCode as 201, Place as ‘Nainital”,
No_of _travellers as 10, No_of_buses as 1.

A Function NewTavel( ) which allows user to enter TravelCode, Place and


No_Of_travellers. Also, assign the value of No_of_buses as per the following
conditions:
No_of_travellers No_of _buses
Less than 20 1
Equql to or more than 20 and less than 40 2
Equal to 40 or more than 40 3
A function ShowTravel() to display the content from all the data members on
screen.

d Answer the questions (i) to (iv) based on the following code :


class Trainer
{
char TNo [5], TName [20], Specialisation [10];
int Days;
protected :
float Remuneration;
void AssignRem (float);
public:
Trainer ( );
void TEntry ( );
void TDisplay( );
};

class Learner
{
char Regno [10], LName [20], Program [10];
Protected :
int Attendance, Grade;
public:
Learner ( );
void LEntry ( );
void LDisplay ( );
};

class Institute : public Learner, public Trainer


{
char ICode[10], IName [20];
public:
Institute ( );
void IEntry ( );
void IDisplay ( );
};
(i) Which type of Inheritance is depicted by the above example?
(ii) Identify the member function(s) that cannot be called directly from the
objects of class Institute from the following
TEntry( )
LDisplay()
IEntry()
(iii) Write name of all the member(s) accessible from member functions of class
Institute.
(iv) If class Institute was derived privately from class Learner and privately from
class Trainer, then, name the member function(s) that could be accessed
through Objects of class Institute.

3 a . write a function SWAP2CHANGE() in c++ to modify the content of the array in 3


. . such a way that the elements which are multiples of 10 swap with the value
present in the very next position in the array.
For example:
If the content of array is 91,50,54,22,30,54
The result should be 91,54,50,22,54,30

b An array Arr[15][20] is stored in the memory along the row with each 4
element occupying 4 bytes. Find out the Base Address and address of the
element Arr[3][2], if the element Arr[5][2] is stored at the address 1500.
c write a function in c++ to perform Insert operation in a Dynamic Queue 4
containing DVD’s information( represented with the help of an array of
structure DVD)
struct DVD
{
long no;
char title[20];
DVD *link;
};

d write a function SORTPOINTS() IN C++ to sort an array of structure 3


Game in order of points using Bubble Sort
struct Game
{
long pno;
char pname[20];
long points;
};

e evaluate the following postfix notation of expression.(show status of stack 2


after each operation)
True, False, NOT, OR, False, True, OR, AND

4 a Observe the program segment carefully and answer the question that follows - 1
class item
{
int item_no;
char item_name[20];
public:
void enterDetail( );
void showDetail( );
int getItem_no( ){ return item_no ;}
};
void modify(item x, int y )
{
fstream File;
File.open( “item.dat”, ios::binary | ios::in | ios::out) ;
item i;
int recordsRead = 0, found = 0;
while(!found && File.read((char*) &i , sizeof (i)))
{
recordsRead++;
if (i . getItem_no( ) = = y )
{
_________________________//Missing statement
File.write((char*) &x , sizeof (x));
found = 1;
}
}
if (! found)
cout << ”Record for modification does not exist”;
File.close() ;
}
If the function modify( ) is supposed to modify a record in the file “ item.dat “, in
which item_no is y, with the values of item x passed as argument, write the
appropriate statement for the missing statement using seekp( ) or seekg( ),
whichever is needed, in the above code that would write the modified record at
its proper place.

b Write a function in C++ to count the number of lowercase alphabets present in 2


a text file
“POEM.TXT”.
c Given the binary file STUDENT.DAT , containing the records of the following 3
class:
class student
{
int roll_no;
char name[20];
float percentage;
public:
void inputData( );
void showData( );
float getPercent( )
{
return percent;
}
};
Write a function perc_below75( ) in C++ , that would count and display the
records of those students whose percentage is below 75.

5 a What do you understand by Primary Key & Candidate Keys? Give example 2
b Consider the following tables Employees and EmpSalary. Write SQL commands 6
for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii)
(i) To show firstname,lastname,address and city of all employees living
in Paris
(ii) To display the content of Employees table in descending order of
Firstname.
(iii) To display the firstname, lastname and total salary of all managers
from the tables
Employee and empsalary , where total salary is calculated as
salary+benefits.
(iv) To display the maximum salary among managers and clerks from the
table Empsalary.
Give the Output of following SQL commands:
(v) (Select firstname, salary from employees , empsalary where
designation = ‘Salesman’
and Employees.empid=Empsalary.empid;
(vi) Select count(distinct designation) from empsalary;
(vii) Select designation, sum(salary) from empsalary group by
designation having count(*)
>2;
(viii) Select sum(benefits) from empsalary where designation =’Clerk’;

6 a State and verify demorgan’s Law 2


b Write the equivalent Canonical Product of Sum Expression for the following Sum 1
of Product Expression F(X, Y, Z) = ∏(0, 2, 4, 5)
c Write the equivalent Boolean expression for the following Logic Circuit. 2
d Reduce the following Boolean expression using K-Map : 3
F(A, B, C, D) = (5,6,7,8,9,12,13,14,15)

7 a Define the term Firewall 1


b Expand the following terminologies: 2
(i) HTML (ii) FTP
(iii) FSF (iv) NIC
c What is the purpose of using a Web Browser? 2
Name any two commonly used Web Browser.
d Write one advantage and one disadvantage of star topology 1
e (e) “Hindustan Connecting World Association” is planning to start 4
their offices in four major cities in India to provide regional IT
infrastructure support in the field of Education & Culture. The company
has planned to set up their head office in New Delhi in three locations
and have named their New Delhi offices as “Sales Office”, ”Head Office”
and “Tech Office”. The company’s regional offices are located at
”Coimbatore”, “Kolkata” and “Ahmedabad”. A rough layout of the
same is as follows :

Approximate distances between these offices as per network


survey team is as follows :
Place From Place To
Distance
Head Office Sales Office
10 KM
Head Office Tech Office
70 Meter
Head Office Kolkata Office
1291 KM
Head Office Ahmedabad Office
790 KM
Head Office Coimbatore Office
1952 KM
In continuation of the above, the company experts have planned to install the
following number of computers in each of their offices :
Head Office 100
Sales Office 20
Tech Office 50
Kolkata Office 50
Ahmedabad Office 50
Coimbatore Office 50
(i) Suggest network type (out of LAN, MAN, WAN) for connecting each of the
following set of their
offices :
 Head Office and Tech Office
 Head Office and Coimbatore Office
(ii) Suggest the most suitable place (i.e. office) to house the server of this
organization with a
Suitable reason.
(iii) Which of the communication media, will you suggest to be procured by the
company for connecting their local offices in New Delhi for very effective and
fast communication ?
(iv) Suggest a cable/wiring layout for connecting the company’s local offices
located in New Delhi.

You might also like