CBSE (Science) Class 12CBSE
Account
It's free!

User



Login
Register


      Forgot password?
Share
Notifications

View all notifications
Books Shortlist
Your shortlist is empty

Question Paper Solutions - Computer Science (C++) 2014 - 2015 CBSE (Science) Class 12

SubjectComputer Science (C++)
Year2014 - 2015 (March)

Marks: 70
[12]1
[2]1.1

Find the correct identifiers out of the following, which can be used for naming Variable, Constants or Functions in a C++ program.

For, while, INT, NeW, delete, lstName, Add+Subtract, namel

Chapter: [6] Object Oriented Programming in C++
Concept: Concept of Object Oriented Programming in C++
[1]1.2

Observe the following program very carefully and write the names of those header files (s), which are essentially needed to compile and execute the following program successfully :

typedef char STRING[80];
void main()
{
    STRING Txt[] ="We love Peace";
    int Count=O;
    while(Txt[Count]!='\0')
    if (isalpha(Txt[Count]))
       Txt[Count++]='@';
    else
       Txt[Count++]='#';
    puts(Txt);
}
Chapter: [6] Object Oriented Programming in C++
Concept: ifstream, ofstream, Classes
[2]1.3

Observe the following C++ code very carefully and rewrite it after removing any/all syntactical errors with each correction underlined.

Note: Assume all required header files are already being included in the program

#Define float MaxSpeed=60.5;
void main()
{
   int MySpeed
   char Alert='N';
   cin>>MySpeed;
   if MySpeed>MaxSpeed
    Alert='Y';
    cout<<A1ert<<endline;
}

 

Chapter: [6] Object Oriented Programming in C++
Concept: Concept of Object Oriented Programming in C++
[2]1.4

Write the output of the following C++ program code :

Note: Assume all required header files are already being included in the program.

void Location(int &X,int Y=4)
{
   Y+=2;
   X+=Y;
}
void main()
{
   int PX=l0,PY=2;
   Location(PY);
   cout<<PX<<","<<PY<<endl;
   Location(PX,PY);
   cout<<PX<<", "<<PY<<endl;
}
Chapter: [6] Object Oriented Programming in C++
Concept: Concept of Object Oriented Programming in C++
[3]1.5

Write the output of the following C++ program code:

Note: Assume all required header files are already being included in the program.

class Eval
{
   char Level;
   int Point;
public:
   Eval(){Level='E'; Point=O;}
   void Sink(int L)
   {
      Level~=L;
   }
   void Float(int L)
   {
      Level+=L;
      Point++;
   }
   void Show()
   {
      cout<<Level<<"#"<<Point<<endl;
   }
};

void main ()
{
   Eval E;
   E.Sink(3);
   E.Show();
   E.Float(7);
   E.Show();
   E.Sink(2);
   E.Show();
}
Chapter: [6] Object Oriented Programming in C++
Concept: Concept of Object Oriented Programming in C++
[2]1.6

Study the following program and select the possible output(s) from the options (i) to (iv) following it. Also; write the maximum and the minimum values that, can be ·assigned to the variable VAL

Note:

-Assume all required header files are already being included in the program.

- random(n) function generates all integer 6, and n-1.

void main ()
{
   randomize();
   int VAL;
   VAL=random(3)+2;
   char GUESS[] ="ABCDEFGHIJK";
   for(int I = 1, I = 1;I <= VAL; I++)
   {
      for (int J=VAL; J<= 7; J++)
      cout<<GUESS[J];
      cout<<endl;
   }
}

1) 

2)

3)

4)

Chapter: [6] Object Oriented Programming in C++
Concept: Concept of Object Oriented Programming in C++
[12]2
[2]2.1

What is a copy constructor?

Chapter: [6] Object Oriented Programming in C++
Concept: Copy Constructor

Give a suitable example in C++ to illustrate with its definition within a class and a declaration of an object with the help of it.

Chapter: [6] Object Oriented Programming in C++
Concept: Class and Object in C++
[2]2.2

Observe the following C++ code and answer the questions (i) and (ii):

class Passenger
{
   long PNR;
   char Name[20];
public:
   Passenger () · //Function 1
   { cout<<"Ready"<<endl; }

   void Book(long P,char N[]) //Function 2
   { PNR = P; strcpy(Name, N);}

   void Print () //Function 3
   { cout«PNR << Name <<endl; }
   
   -Passenger() //Function 4
   { cout<<"Booking cancelled! "<<endl;}
};

1) Fill in the blank statements in Line 1 and Line 2 to execute Function 2 and Function 3 respectively in the following code:

void main()
{
   Passenger P;
   _________      //Line 1
   _________      //Line 2
}//Ends here

2) Which function will be executed at } // Ends here? What is this function referred as?

Chapter: [6] Object Oriented Programming in C++
Concept: Member of a Class - Data Members and Member Functions (Methods)
[4]2.3

Write the definition of a class Photo In C++ with the following description:

Private Members

- Pno    //Data member for Photo Number (an integer)

-Category //Data.member for Photo Category (a string)

- Exhibit I // Data member for Exhibition Gallery (a string) 

- FixExhibit //A member function to assign Exhibition Gallery as per Category as shown in the following table

Category Exhibit
Antique Zaveri
Modern Johnsen
Classic Terenida

Public Members

-Register()   //A function to allow user to enter values Pno I category and call FixExhibi t () function

- ViewAll()  //A function to display all the data members

Chapter: [6] Object Oriented Programming in C++
Concept: Member of a Class - Data Members and Member Functions (Methods)
[4]2.4

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

class Interior
{
    int Orderid;
    char Address[20];
protected:
   float Advance;
public:
   Interior();
   void Book(); void View();
};

class Painting:public Interior
{
    int Wall,Area,ColorCode;
protected:
    char Type;
public:
   Painting();
   void PBook();
   void PView();
};

class Billing : public Painting
{
   float Charges;
   void Calculate();
public:
   Billing();
   void Bill();
   void BillPrint();
};

1) Which type of Inheritance out of the following is illustrated in the above example?

  • Single Level Inheritance
  • Multi-Level Inheritance
  • Multiple Inheritance

2) Write the names of all the data members, which are directly accessible from the member functions of class Painting.

3) Write the names of all the member functions, which are directly accessible from an object of class Billing.

4) What will be the order of execution of the constructors, when an object of class Billing is declared?

Chapter: [6] Object Oriented Programming in C++
Concept: Inheritance in C++
[14]3
[2]3.1

Write the definition of a function Change(int P[], int N) in C++, which should change all the multiples of 10 in the array to 10 and rest of the elements as 1. For example, if an array of 10 integers is as follows:

P[0] P[1] P[2] P[3] P[4] P[5] P[6] P[7] P[8] P[9]
100 43 20 56 32 91 80 40 45 21

After executing the function, the array content should be changed as follows:

P[0] P[1] P[2] P[3] P[4] P[5] P[6] P[7] P[8] P[9]
10 1 10 1 1 1 10 10 1 1

 

Chapter: [6] Object Oriented Programming in C++
Concept: Pointers and Arrays - Array of Pointers, Pointer to an Array (1 Dimensional Array), Function Returning a Pointer, Reference Variables and Use of Alias
[3]3.2

A two-dimensional array ARR[50][20] is stored in the memory along the row with each of its elements occupying 4 bytes. Find the address of the element ARR[30] [10], if the element ARR[10] [5] is stored at the memory location 15000.

Chapter: [7] Data Structures
Concept: One and Two Dimensional Arrays - Sequential Allocation and Address Calculation
[4]3.3

Write the definition of a member function PUSH( ) in C++, to add a new book in a dynamic stack of BOOKS considering the following code is already included in the program

struct BOOKS
{
   char ISBN[20], TITLE[80];
   BOOKS *Link;
};
class STACK
{
   BOOKS *Top;
public:
   STACK-() {Top=NULL;}
   void PUSH();
   void POP();
   ~STACK();
};
Chapter: [6] Object Oriented Programming in C++
Concept: Member of a Class - Data Members and Member Functions (Methods)
[3]3.4

Write a function REVROW(int P[] [5], int N, int M) in C++ to display the content of a two-dimensional array, with each row content in reverse order.

For example, if the content of the array is as follows:

15 12 56 45 51
13 91 92 87 63
11 23 61 46 81

The function should display output as

Chapter: [7] Data Structures
Concept: One and Two Dimensional Arrays - Sequential Allocation and Address Calculation
[2]3.5

Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion

U * V + R/(S - T)

Chapter: [7] Data Structures
Concept: Operations on Stack (PUSH and POP) and Its Implementation in C++
[6]4
[2]4.1

Write function definition for TOWER() in C++ to read the content of a text file WRITEUP.TXT, count the presence of word TOWER and display the number of occurrences of this word.

Note:

  •  The word TOWER should be an independent word
  • Ignore type cases (i.e. lower/upper case)

Example:

If the content of the file WRITEUP.TXT is as follows:

Tower of hanoi is an interesting problem. Mobile phone tower is away from here. Views from EIFFEL TOWER are amazing.

The function TOWER( ) should display the following :

3
Chapter: [6] Object Oriented Programming in C++
Concept: ifstream, ofstream, Classes
[3]4.2

Write a definition for function COSTLY() in C++ to read each record of a binary file GIFTS.DAT, find and display those items, which are priced more than 2000. Assume that the file GIFTS.DAT is created with the help of objects of class GIFTS, which is defined below

c1ass GIFTS
{
   int CODE; char ITEM[20]; f1oat PRICE;
pub1ic:
   void Procure()
  {
       cin>>CODE; gets (ITEM);cin>>PRICE;
  }
  void View()
  {
      cout<<CODE<<":"<<ITEM<<":"<<PRICE<<end1;
  }
  f1oat GetPrice () {return PRICE;}
};
Chapter: [6] Object Oriented Programming in C++
Concept: Binary File in C++ :- Creation of File, Writing Data into File, Searching for Required Data from File, Appending Data to a File, Insertion of Data in Sorted File, Deletion of Data from File, Modification of Data in a File
[1]4.3

Find the output of the following C++ code considering that the binary file MEMBER.DAT exists on the hard disk with records of 100 members :

c1ass MEMBER
{
  int Mno; char Name[20];
pub1ic:
  void In();void Out();
};

void main()
{
  fstream MF;
  MF.open("MEMBER. DAT" , ios::binary|ios::in);,

  MEMBER M;
  MF.read((char*)&M, sizeof(M));
  MF. read( (char*) &M, sizeof (M));
  MF. read ((char*) &M, si:zeof (M));
  int POSITION= MF. te11g 0 / sizeof (M);
  cout<<"PRESENT RECORD:"<<POSITION<<end1;
  MF.c1ose();
}
Chapter: [6] Object Oriented Programming in C++
Concept: Binary File in C++ :- Creation of File, Writing Data into File, Searching for Required Data from File, Appending Data to a File, Insertion of Data in Sorted File, Deletion of Data from File, Modification of Data in a File
[8]5
[2]5.1

Observe the following table carefully and· write the names of the most appropriate columns, which can be considered as (i) candidate keys and. (ii) primary key:

Code Item Qty Price Transaction Date
1001 Plastic Folder 14" 100 3400 2014-12-14
1004 Pen Stand Standard 200 4500 2015-01-31
1005 Stapler Mini 250 1200 2015-02-28
1009 Punching Machine Small 200 1400 2015-03-12
1003 Stapler Big 100 1500 2015-02-02
Chapter: [8] Database Management Systems and SQL
Concept: Introduction to Data Base Concepts and Its Need in C++
[6]5.2

Consider the following DEPT and EMPLOYEE tables. Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii).

Table: DEPT

DCODE DEPARTMENT LOCATION
D01 INFRASTRUCTURE DELHI
D02 MARKETING DELHI
D03  MEDIA MUMBAI
D04  FINANCE KOLKATA
D05  HUMAN RESOURCE MUMBAI

Table: EMPLOYEE

ENO NAME DOJ DOB GENDER DCODE
1001 George K 2013-09-02 1991-09-01 MALE D01
1002 Ryma Sen 2012-12-11 1990-12-15 FEMALE D03
1003 Mohitesh 2013-02-03 1987-09--04 MALE D05
1007 Anil Jha 2014-01-17 1984-10-19 MALE D04
1004 Manila Sahai 2012-12-09 1986-11-14 FEMALE D01
1005 R SAHAY 2013-11-18 1987-03-31 MALE D02
1006 Jaya Priya 2014-06-09 1985-06-23 FEMALE D05

Note: DOJ refers to the date of joining ·and DOB refers to the date of Birth of employees

1) To display Eno, Name, Gender from the table EMPLOYEE in ascending order of Eno.

2) To display the Name of all the MALE Employees from the table EMPLOYEE.

3) To display the Eno and Name of those employees from the table EMPLOYEE who are born between '1987-01-01' and '1991-12-01'.

4) To count and display FEMALE employees who have Joined after '1986-01-01'.

5) SELECT COUNT(*), DCODE FROM EMPLOYEE GROUP BY DCODE HAVING COUNT(*)>1;

6) SELECT DISTINCT DEPARTMENT FROM DEPT;

7) SELECT NAME, DEPARTMENT FROM EMPLOYEE E, DEPT D WHERE E.DCODE=D.DCODE AND EN0<1003;

8) SELECT MAX(DOJ), MIN(DOB) FROM EMPLOYEE;

Chapter: [3] Python - Databases and SQL
Concept: Structured Query Language Advantages of Using SQL
[8]6
[2]6.1

Verify the following using Boolean Laws : U'+V = U'V'+ U' .V + U.V

Chapter: [9] C++ Boolean Algebra
Concept: Commutative Law
[2]6.2

Draw the Logic Circuit for the following Boolean Expression: (X'+Y).Z + W'

Chapter: [9] C++ Boolean Algebra
Concept: Application of Boolean Logic - Digital Electronic Circuit Design Using Basic Logic Gates (NOT, AND, OR, NAND, NOR)
[1]6.3

Derive a Canonical POS expression for a Boolean function F, represented by the following truth table

P Q R F(P,Q,R)
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1

 

Chapter: [4] Python - Boolean Algebra
Concept: Obtaining Sum of Product (SOP) and Product of Sum (POS) Form the Truth Table
[3]6.4

Reduce the following Boolean Expression to its simplest form using K-Map

`F (X, Y, Z, W) = sum (0, 1, 4, 5, 6, 7, 8, 9, 11, 15)`

Chapter: [1] Boolean Algebra
Concept: Use of Karnaugh Map for Minimization of Boolean Expressions (Up to 4 Variables)
[7]7
[1]7.1

illustrate the layout for connecting 5 computers in a Bus topology of Networks

Chapter: [5] Python - Communication Technologies
Concept: Network Topologies and Types - Bus, Star, Tree, PAN, LAN, WAN, MAN

illustrate the layout for connecting 5 computers in a star topology of Networks

Chapter: [5] Python - Communication Technologies
Concept: Network Topologies and Types - Bus, Star, Tree, PAN, LAN, WAN, MAN
[1]7.2

What kind of data gets stored in cookies and how is it useful ?

Chapter: [5] Python - Communication Technologies
Concept: Internet
[1]7.3

Differentiate between packet switching over message switching

Chapter: [5] Python - Communication Technologies
Concept: Network Devices - Modem, RJ45 Connector, Ethernet Card, Router, Switch, Gateway, Wifi Card
[1]7.4

Out of the following, which is the fastest (i) wired and (ii) Wireless meium of communication ?

·Infrared, Coaxial Gable, Ethernet Cable, Microwave, Optical Fiber

Chapter: [10] Networking and Open Source Software
Concept: Internet Wireless/Mobile Communication Protocol - GSM, CDMA, GPRS, and WLL
[1]7.5

What is Trojan Horse?

Chapter: [10] Networking and Open Source Software
Concept: Threats and Prevention from Viruses, Worms, Trojan Horse, Spam
[1]7.6

Out of the following, which all comes under cyber crime ?

1) Stealing away a brand new hard disk from a showroom

2) Getting in someone's social networking account without his consent and posting on his behalf

3) Secretly copying data from server of an organization and selling it to the other organization.

4) Looking at online activities of a friends blog.

Chapter: [5] Python - Communication Technologies
Concept: Cyber Crimes
[4]7.7

Xcelencia Edu Services Ltd. is an educational organization. It is planning to set up its India campus at Hyderabad with its head office at Delhi. The Hyderabad campus has 4 main
buildings ADMIN, SCIENCE, BUSINESS and ARTS.

You as a network expert have to suggest the best network related . solutions for their problems raised in (i) to (iv), keeping in mind the distances between the buildings and other given parameters.

Shortest distances between various buildings :

ADMIN to SCIENCE 65m
ADMIN to BUSINESS 100m
ADMIN to ARTS 60m
SCIENCE to BUSINESS 75m
SCIENCE to ARTS 60m
BUSINESS to ARTS 50m
DELHI Head Office to HYDERABAD Campus 1600Km

Number of computers installed at various buildings are as follows :

ADMIN 100
SCIENCE 85
BUSSINESS 40
ARTS 12
DELHI Head Office 20

1) Suggest the most appropriate location of the server inside the HYDERABAD campus (out of the 4 buildingakto get the best connectivity for maximum number of computers. Justify your answer

2) Suggest . and draw the cable layout to efficiently connect various buildings within the HYDERABAD campus for connecting the computers.

3) Which hardware device will you suggest to be procured by the company to be installed to protect and control the internet uses within the campus?

4) Which of the following will you suggest to establish the online face-to-face communication between the people in the Admin Office of HYDERABAD campus and · DELHI Head Office ?

  • E-mail
  • Text Chat
  • Video Conferencing
  • Cable TV
Chapter: [5] Python - Communication Technologies
Concept: Network Topologies and Types - Bus, Star, Tree, PAN, LAN, WAN, MAN
S