Computer Science[C++] 2014 CBSE [ Delhi ] Set 1

Welcome to Extramarks
Computer Science[C++] 2014 CBSE [ Delhi ] Set 1
1. All questions are compulsary.2. Please give the explanation for the answer where applicable.3. To view the answer, click on the Answer link alongside the Question.

Time Allotted:03:00:00 Maximum Marks:70

Question 1 :

(a) What is the difference between actual and formal parameters? Give a suitable example to illustrate using a C++ code.

(b) Observe the following C++ code and write the name(s) of the header file(s), which will be essentially required to run it in a C++ compiler:

void main( )

{

char Text[20], C;

cin >>Text;

C=tolower(Text[0]);

cout<< C<< ” is the first char of” << Text<< endl;

}

(C) Rewrite the following C++ code after removing all the syntax error(s), if present in the code. Make sure that you underline each correction done by you in the code.

Important Note:

- Assume that all the required header files are already included, which are essential to run this code.
-
The corrections made by you do not change the logic of the program.

typedef char[50] STRING;

void main()

{

City STRING;

gets(City);

cout<< City[0]<< ’ t << City[2];

cout<< City<< endline;

}

(d) Obtain the output from the following C++ program as expected to appear on the screen after its execution.

Important Note:

- All the desired header files are already included in the code, which are required to run the code.

void main()

{

Char *String=”SARGAM”;

int *Ptr, A[]={1,5,7,9};

Ptr=A;

cout<< *Ptr << String<< endl;

String++;

Ptr+=3;

cout<< *Ptr << String << endl;

}

(e) Obtain the output of the following C++ program, which will appear on the screen after its execution.


Important Note:

- All the desired header files are already included in the code, which are required to run the code.


class Player

{

int Score, Level;

char Game;

public:

Player(char GGame=’A’)

{

Score=0; Level=1; Game=GGame;

}

void Start(int SC);

void Next();

void Disp()

{

cout << Game << ”@” << Level << endl;

cout << Score << endl;

}

};

void main()

{

Player P,Q(‘B’);

P.Disp();

Q.Start(75);

Q.Next();

P.Start(120);

Q.Disp();

P.Disp();

}

void Player::Next()

{

Game = (Game==’A’)? ’B’: ‘A’;

}

void Player::Start(int SC)

{

Score+=SC;

If (Score>=100)

Level=3;

else if(Score>=50)

Level=2;

else

Level=1;

}

(f) Read the following C++ code carefully and find out which out of the given options (i) to (iv) are the expected correct output(s) of it. Also, write the maximum and minimum value that can be assigned to the variable Start used in the code:

void main()

{

int Guess[4]={200,150,20,250};

int Start=random(2) + 2;

for( int C=Start;C < 4 ; C++)

cout << Guess[C] << ”#”;

}

(i) 200#150# (iii) 150#20#250#

(ii) 150#20# (iv) 20#250#


[2+1+2+2+3+2=12]

(12 Marks)
View Answer »


Question 2 :

(a) Write 4 characteristics of a constructor function used in a class.

(b) Answer the questions (i) and (ii) after going through the following class:

class Health

{

int PID, Did;

public: Health(int PPId); //Function 1

Health(); //Function 2

Health(Health &H); //Function 3

void Entry(); //Function 4

void Display(); //Function 5

} ;

void main()

{

Health H(20); //Statement 1

}

i) Which of the function out of Function 1,2,3,4 or 5 will get executed when the Statement 1 is executed in the above code?
ii) Write a statement to declare a new object G with reference to already existing object H using Function 3.


(c) Define a class CABS in C++ with the following specification:

Data Members

• CNo-to store Cab No

• Type- to store a character ‘A’, ‘B’ or ‘C’ as City Type

• PKM- to store per Kilo Meter charges

• Dist- to store Distance travelled ( in KM)

Member Functions

• A constructor function to initialize Type as ‘A’ and CNo as ‘1111’

• A function Charges() to assign PKM as per the following table:

Type

PKM

A

25

B

20

C

15



•
A function Register() to allow administrator to enter the values for CNO and Type. Also, this function should call Charges() to assign PKM charges.

• A function ShowCab() to allow user to enter the value of Distance and display CNo, Type, PKM, PKM*Distance(as Amount) on screen.

(d) Consider the following C++ code and answer the questions from (i) to (iv):

Class Campus

{

long Id;

char City[20];

protected:

char Country[20];

public:

Campus();

void Register();

void Display();

};

class Dept: private Campus

{

long DCode[10];

char HOD[20];

protected :

double Budget;

public:

Dept();

void Enter();

void Show();

}

class Applicant: public Dept

{

long RegNo;

char Name[20];

public:

Applicant();

void Enroll();

void View();

};

1) Which type of Inheritance is shown in the above example?

2) Write the names of those member functions, which are directly accessed from the objects of class Applicant.
3)
Write the names of those data members, which can be directly accessible from the member functions of class Applicant.
4)
Is it possible to directly call function Display() of class University from an object of class Dept? (Answer as Yes/No).

[2+2+4+4=12]

(12 Marks)
View Answer »


Question 3 :

(a) Write code for a function offEven(int s[], int N) in C++, to add 5 in all the odd values and 10 in all the even values of the array S.

Example: If the original content of the array S is

The modified content will be:

(b) An array T[25][20] is stored along the row in the memory with each element requiring 2 bytes of storage. If the base address of array T is 42000, find out the location of T[10][15]. Also, find the total number of elements present in this array.

(c) Write a user-defined function SumLast3(int A[][4], int N, int M) in C++ to find and display the sum of all the values, which are ending with 3 (i.e., units place is 3). For example if the content of array is:

33

13

92

99

3

12




The output should be 49.

(d) Evaluate the following postfix expression. Show the status of stack after execution of each operation separately:

F, T, NOT, AND, F, OR, T, AND

(e) Write a function POPBOOK() in C++ to perform delete operation from a Dynamic Stack, which contains Bno and Title. Consider the following definition of NODE, while writing your C++ code.

struct NODE

{

int Bno;

char Title[20];

NODE *Link;

};

[3+3+2+2+4=14]

(14 Marks)
View Answer »


Question 4 :

(a) Fill in the blanks marked as Statement 1 and Statement 2, in the program segment given below with appropriate functions for the required task.

class Medical

{

int RNo; // Representative Code

char Name[20]; // Representative Name

char Mobile[12]; // Representative Mobile

public:

void Input(); //Function to enter all details

void Show(); //Function to display all details

int RRno();

{

Return RNo;

}

void ChangeMobile() //Function to change Mobile

{

cout<< ” Changed Mobile: ”;

gets(Mobile);

}

};

void RepUpdate()

{

fstream F;

F.open(“REP.DAT”, ios::binary|ios::in|ios::out);

int Change=0;

int URno;

cout<< ”Rno (Rep No-to Update Mobile):”;

cin >> URno;

Medical M;

while(!Change && F.read((char*)&M, sizeof(M)))

{

if(M.Rno()==URno)

{

//Statement 1: To call the function to change Mobile No.

________________________

//Statement 2: To reposition file pointer to re-write

//the updated object back in the file

_________________________

F,write((char*)&M, sizeof(M);

Change++;

}

if(Change)

cout<< ”Mobile changed for Rep ”<< URno<< endl;

else

cout<< ”Rep not in the Medical”<< endl;

F.close();

}

(b) Write a function EUCount() in C++, which should read each character of a text file IMP.TXT, should count and display the occurrence of alphabets E and U(including small cases e and u too).

Example-

If the file content is as follows:

Updated information

is simplified by official websites.

The EUCount() function should display the output as

E:4

U:1

(c) Assuming the class GAMES as declared below, write a function in C++ to read the objects of GAMES from binary file GAMES.DAT and display those details of those GAMES, which are meant for children of AgeRage “8 to 13”.

Class GAMES

{

int GameCode;

char GameName[10];

cahr AgeRange;

public:

void Enter()

{

cin >> GameCode;

gets(GameName);

gets(AgeRange);

}

void Display()

{

cout << GameCode<< ”:”<< GameName<< endl;

cout << AgeRange<< endl;

}

char *AgeR()

{

return AgeRange;

}

};

[1+2+3=6]

(6 Marks)
View Answer »


Question 5 :

(a) Explain the concept of Union between two tables, with the help of appropriate example.

Note:

Answer the questions (b) and (c) on the basis of the following tables STORE and ITEM

Table: STORE

SNo

SName

Area

S01

ABC Computronics

GK II

S01

ALL Infotech Media

CP

S02

Tech Shoppe

Nehru Place

S04

Geeks Tecno Soft

Nehru Place

S05

Hitech Tech Store

CP

Table: ITEM

INo

IName

Price

SNo

T01

Mother Board

12000

S01

T02

Hard Disk

5000

S01

T03

Keyboard

500

S02

T04

Mouse

300

S01

T05

Mother Board

400

S03

T06

Key Board

400

S03

T07

LCD

6000

S04

T08

LCD

5500

S05

T09

Mouse

350

S05

T10

Hard Disk

4500

S03

(b) Write the SQL queries(1 to 4)

1) To display IName and Price of all the Items in ascending order of their price.

2) To display SNo and SName of all Stores located in CP.

3) To display Minimum and Maximum Price of each IName from the table Item.

4) To display IName, Price of all items and their respective SName where they are available.

(c) Write the output of the following SQL commands (1 to 4):

1) SELECT DISTINCT INAME FROM ITEM WHERE PRICE>=5000;
2)
SELECT AREA, COUNT(*) FROM STORE GROUP BY AREA;
3)
SELECT COUNT(DISTINCT AREA) FROM STORE;
4)
SELECT INAME, PRICE*0.05 DISCOUNT FROM ITEM WHERE SNO IN (‘S02’,’S03’);

[2+1+1+1+1+2=8]

(8 Marks)
View Answer »


Question 6 :

(a)

Na Name the law shown below and verify it using a truth table.


A+B.C = (A+B).(A+C)

(b) Obtain the Boolean Expression for the logic circuit shown below:

(c) Write the Sum of Product form of the function F(P,Q,R) for the following truth table representation of F:

P

Q

R

F

0

0

0

1

0

0

1

0

0

1

0

0

0

1

1

1

1

0

0

0

1

0

1

0

1

1

0

1

1

1

1

1


(d) Obtain the minimal form for the following Boolean expression using Karnaugh’s Map.

F(A,B,C,D)= ∑ (1, 4, 5, 9, 11, 12, 13, 15)

[2+2+1+3=8]

(8 Marks)
View Answer »


Question 7 :

(a) Write one characteristics each of 2G and 3G Mobile Technologies.

(b) What is the difference between Video Conferencing and Chat?

(c) Expand the following:

� GPRS

� CDMA

(d) Which type of network ( out of LAN, PAN and MAN ) is formed, when you connect two mobiles using Bluetooth to transfer a picture file.

(e) Trine Tech Corporation ( TTC ) is professional consultancy company. The company is planning to set up their new offices in India with its hub at Hyderabad. As network adviser, you have to understand their requirement and suggest them the best available solutions. Their queries are mentioned as (i) to (iv) below.

Physical Location of the blocks of TTC:



Block to Block distances( in Mtrs.)

Block(From)

Block(To)

Distance

Human Resource

Conference

110

Human Resource

Finance

40

Conference

Finance

80


Expected Number of Computers to be installed in each block

Block

Computers

Human Resource

25

Finance

120

Conference

90

(i) What will the most appropriate block, where TTC should plan to install their server?

(ii) Draw a block to cable layout to connect all the buildings in the most appropriate manner for efficient communication.

(iii) What will be the best possible connectivity out of the following, you will suggest to connect the new setup of offices in Bangalore with its London based office.

� Satellite Link

� Infrared

� Ethernet Cable

(iv) Which of the following device will be suggested by you to connect each computer in each of the buildings?

� Switch

� Modem

� Gateway

(f) Write names of any two popular Open Source Software, which are used as operating system.

(g) Write any two important characteristics of Cloud Computing.


[1+1+1+1+1+1+1+1+1+1=10]

(10 Marks)
View Answer »

No comments:

Post a Comment