Вы находитесь на странице: 1из 7

NAVODAYA VIDYALAYA SAMITI

CHANDIGARH REGION
Computer Science (083) Pre-Board – I
(2017-18)

Time Allowed: 3 Hours Maximum Marks: 70


Instructions:
(i) All questions are compulsory.
(ii) Programming Language : C++, SQL

Que.1 Answer the following questions:


a) Write the names of the header files to which the following belong: (1)
(i) gets( ) (ii) islower( )
b) What is the difference between # define and const? (2)
c) Rewrite the following program after removing the syntactical errors (if any). Underline each
correction. (2)
#include<iostream.h>
void main( )
int A[10];
A=[3,2,5,4,7,9,10];
for( p = 0; p<=6; p++)
{
if(A[p]%2=0)
int S = S+A[p];
}
cout<<S;
}
d) Find the output of the following program. (2)
#include<iostream.h>
int global = 10;
void callme(int &x, int y)
{
x - = y;
y = x * 10;
cout<<x<<':'<<y<<endl;
}
void main()
{
int global = 7;
callme(::global,global);
cout<<global<<':'<<::global<<endl;
callme(global,::global);
cout<<global<<':'<<::global<<endl;
}

1|P a ge
e) What is the minimum and maximum value that can be assigned to the variable R in the
following program: (2)
#include<stdlib.h>
#include<iostream.h>
void main( )
{
randomize( );
int Num , R ;
cin >> Num ; // Assume user entered the value as 10
R = random (Num) + 5 ;
for (int I = 0 ; I<= R ; I++)
{
cout << N<< “:” ;
}
}
f) Find the output of the following program - (3)
#include<iostream.h>
void pass(int *ptr)
{
for(int *pt=ptr ; pt<ptr+2 ;pt++)
cout<<*pt<<'-';
cout<<endl;
}
void main()
{
int box = {10,33,17,12,20};
pass(box);
pass(box+1);
pass(&box[2]);
}
Que. 2 Answer the following questions:
a) What do you understand by data abstraction and data hiding? How they are implemented in
C++? (2)
b) Answer the questions (i) and (ii) after going through the following class: (2)
class WORK
{
int WorkID;
char WorkType;
public:
~WORK( ) // Function 1
{
cout<<”Un-Allocated”<<endl;
}
void status( ) // Function 2
{
cout<<WorkID<<”;”<<WorkType<<endl;
}
2|P a ge
WORK( ) // Function 3
{
WorkID=10;
WorkType=’T’;
}
WORK(WORK&W) // Function 4
{
WorkID=W.WorkID+12;
WorkType=W.WorkType+1;
}
};
(i) Which member function out of function1, function2, function3 and function4 shown in the
above example of class WORK is called automatically, when the scope of an object gets over?
What is it called?
(ii) Write the C++ statement that would invoke function3 and function 4.
c) Define a class TravelPlan in C++ with the following description: (4)
Private Members:
 PlanCode of type long
 Place of type string
 NOT(No_of_Travellers) of type integer
 NOB(No of Buses) of type integer
Public Members:
 A constructor to assign initial values of PlanCode as 1001, Place as "Agra", NOT as 5, NOB
as 1
 A function NewPlan() which allows users to enter PlanCode, Place and NOT. The function
assigns the value of NOB as per the following conditions:
Number of Travellers Number of Buses
Less than 20 1
Equal to or more than 20 and less than 40 2
Equal to 40 or more than 40 3
A function ShowPlan() to display the content of all the data members.
d) Answer the questions (i) to (iv) based on the following: (4)
class FacetoFace
{
char CenterCode[10];
public:
void Input( );
void Output( );
};
class Online
{
char Website[50];
public:
void Sitein( );
void Siteout( );
};
class Training : public FacetoFace, private Online
{
long Tcode;
3|P a ge
float Charge;
int Period;
public:
void Register( );
void Show ( );
};
(i) Which type of inheritance is shown in the above example?
(ii) Write names of all member functions accessible from Show( ) function of class Training.
(iii) Write names of all the members accessible through an object of class Training.
(iv) Is the function Output( ) accessible inside the function Siteout( )? Justify you answer.

Que. 3 Answer the following questions

a) Write a C++ function to sort any array of n elements using insertion sort. Array should be
passed as argument to the function. (2)
b) An array T[50][20] is stored in the memory along the column with each element occupying 4
bytes. Find out the base address and address of element T[30][15], if an element T[25][10] is
stored at the memory location 9800. (3)

c) Write a code in C++ for the Push and Pop functions of a dynamically allocated Stack
containing name of cities. (4)
Assume the following definition of node.

struct node
{
char city[30];
node *link;
};
d) Write a C++ function to print both the diagonal of a square matrix. e.g. (3)
Then the output should be:

2 3 5
Diagonal 1: 2 3 3
1 3 6
9 4 3 Diagonal 2: 5 3 9

e) Evaluate the following postfix expression using a stack and show the contents of the stack after
each operation. (2)
100, 40, 8, +, 20, 10, -, +, *
Que. 4 Answer the following questions:
a) Differentiate between read() and write() function in terms of file handling? (1)
b) Write a function in C++ which opens a text file Sample.txt and count the number of lines
present in the file and displays it. (2)
c) A binary file “ADDRESS.DAT”, containing records of the following class colony type. (3)
class colony
{
char c_no[10];
char c_name[40];
long no_of_ppl;
4|P a ge
public:
void getdata( )
{
gets(c_no);
gets(c_name);
cin>>no_of_ppl;
}
void showdata( )
{
cout<<”Colony Number : “<<c_no;
cout<<”Colony Name : “<<c_name;
cout<<” No. of people : “<<no_of_ppl;
}
char * returnname( )
{
return c_name;
}
};
Write a function showaddress( ) in C++ that would read contents of file “ADDRESS.DAT” and
display the details of those colonies where number of people are greater than 1000.

Que. 5 Answer the following questions:


a) State and prove De Morgan’s theorem. (2)
b) Write the SOP form of the function F given in the truth table below: (2)
X Y Z F (output)
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

c) Write the Boolean Expressions for the following Logic Circuit. (1)

d) Obtain the simplified form of the Boolean Expression using K’ Map: (3)
F( x , y , z, w) = ∑ (0,2,4,5,8,9,12,13,15)

Que.6 Answer the following questions:


a) Differentiate between DDL & DML. Also give example. (2)

5|P a ge
b) Consider the following tables Stationery and Consumer. Write SQL commands for the
statement (i) to (iv) and give outputs for SQL queries (v) to (viii). (6)

Table: Stationery
S_ID StationeryName Company Price
DP01 Dot Pen ABC 10
PL02 Pencil XYZ 6
ER05 Eraser XYZ 7
PL01 Pencil CAM 5
GP02 Gel Pen ABC 15

Table: Consumer
C_ID ConsumerName Address S_ID
01 Good Learner Delhi PL01
06 Write Well Mumbai GP02
12 Topper Delhi DP01
15 Write & Draw Delhi PL02
16 Motivation Banglore PL01

(i) To display the details of those consumers whose Address is Delhi.


(ii) To display the details of Stationery whose Price is in the range of 8 to 15. (Both Value
included)
(iii) To display the ConsumerName, Address from Table Consumer, and Company and Price
from table Stationery, with their corresponding matching S_ID.
(iv) To increase the Price of all Stationery by 2.

(v) SELECT DISTINCT Address FROM Consumer;


(vi) SELECT Company, MAX(Price), MIN(Price), COUNT(*) from Stationery GROUP BY
Company;
(vii) SELECT Consumer.ConsumerName, Stationery.StationeryName, Stationery.Price FROM
Stationery, Consumer WHERE Consumer.S_ID=Stationery.S_ID;
(viii) Select StationeryName, Price*3 From Stationery;

Que. 7 Answer the following questions:


a) What do you mean by Open Source Software? List few commonly used FOSS. (1)
b) Write the full forms of the following: (1)
(i) PAN (ii) FTP
c) Which of the following units measures the speed with which data can be transmitted from
one node to another node of a network? (1)
(i) KMph (ii) Mbps (iii) MGps
d) “e-Vidya” is an educational Content Provider Company. It is setting up its new campus at
Chandigarh for its web based activities. The campus has four buildings as shown in
diagram below: (4)

6|P a ge
Main Resource
Building Building

Accounts
Training
Building
Building

Center to center distances between various buildings as per architectural drawings (in meters) is
as follows:

Main Building to Resource Building 120m


Main Building to Training Building 40m
Main Building to Accounts Building 135m
Resource Building to Training Building 125m
Resource Building to Accounts Building 45m
Training Building to Accounts Building 110m

Expected number of Computers in each building is as follows:

Main Building 15
Resource Building 25
Training Building 250
Accounts Building 10
(i) Suggest a cable layout of connection between the buildings.
(ii) Suggest the most suitable place (i.e building) to house the server of this Educational
Content Provider Company. Also provide a suitable reason for your suggestion.
(iii) Suggest the placement of the following devices with justification:
i. Repeater
ii. Hub/Switch
(iv) The Company is planning to connect its International office situated in Noida. Which
out of following wired communication links, will you suggest for very high speed
connectivity?
i) Wi-Fi ii) Optical Fibre iii) Ethernet Cable

e) Name the different types of cloud deployment models (1)


f) What is Firewall? Give a suitable example. (1)
g) How is a virus different from a worm? (1)

7|P a ge

Вам также может понравиться