Questions – Exam Papers – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
siteicon
Exam Paper: CBSE-Class 12th-Comp. Sc.-2016-All India (CPP) siteicon No. of Q.31

Out of the following, find those identifiers, which can not be used for naming Variable, Constants or Functions in a C++ program:

Total*Tax, double, Case, My Name,
NeW, switch, Column31, _Amount




Ronica Jose has started learning C++ and has typed the following program. When she compiled the following code written by her, she discovered that she needs to include some header files to successfully compile and execute it. Write the names of those header files, which are required to be included in the code.

void main()
{
  double X,Times,Result;
  cin>>X>>Times;
  Result=pow(X,Times);
  cout<<Result<<endl;
}



Rewrite the following C++ code after removing any/all syntactical errors with each correction underlined.

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

#define Formula(a,b) = 2*a+b
void main()
{
  float X=3.2;Y=4.1;
  Z=Formula(X,Y);
  cout<<'Result='<<Z<<endl;
}



Find and write the output of the following C++ program code:
Note: Assume all required header files are already included in the program.

typedef char TEXT[80];
void JumbleUp(TEXT T)
{
  int L=strlen(T);
  for (int C=0;C<L1;C+=2)
{
  char CT=T[C];
  T[C]=T[C+1]
  T[C+1]=CT;
}
  for (C=1;C<L;C+=2)
  if (T[C]>='M' && T[C]<='U')
  T[C]=’@’;
}
void main()
{
  TEXT Str="HARMONIOUS";
  JumbleUp(Str);
  cout<<Str<<endl;
}



Find and write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program.

class Share
 {
 long int Code;
 float Rate;
 int DD;
 public:
 Share(){Code=1000;Rate=100;DD=1;}
 void GetCode(long int C,float R)
 {
  Code=C;
  Rate=R;
 }
 void Update(int Change,int D)
 {
  Rate+=Change;
  DD=D;
 }
 void Status()
 {
  cout<<"Date:"<<DD<<endl;
  cout<<Code<<"#"<<Rate<<endl;
 }
};
void main()
{
 Share S,T,U;
 S.GetCode(1324,350);
 T.GetCode(1435,250);
 S.Update(50,28);
 U.Update(25,26);
 S.Status();
 T.Status();
 U.Status();
}



Look at the following C++ code and find 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 PICKER.

Note:
– Assume all the required header files are already being included in the code.
– The function random(n) generates an integer between 0 and n-1

void main()
{
  randomize().
  int PICKER.
  PICKER=1+random(3).
  char COLOR[][5]={"BLUE","PINK","GREEN","RED"}.
  for(int I=0;I<=PICKER;I++)
  {
    for(int J=0;J<=I;J++)
      cout<<COLOR[J].
    cout<<endl.
  }
}
(i) (ii) (iii) (iv)
PINK BLUE GREEN BLUE
PINKGREEN BLUEPINK GREENRED BLUEPINK
PINKGREENRED BLUEPINKGREEN BLUEPINKGREEN
BLUEPINKGREENRED



Write any four important characteristics of Object Oriented Programming? Give example of any one of the characteristics using C++.




Observe the following C++ code and answer the questions (i) and (ii). Assume all necessary files are included:

class BOOK
{
  long Code ;
  char Title[20];
  float Price;
public:
  BOOK() //Member Function 1
  {
    cout<<”Bought”<<endl;
    Code=10;strcpy(Title,”NoTitle”);Price=100;
  }
  BOOK(int C,char T[],float P) //Member Function 2
  {
    Code=C;
    strcpy(Title,T);
    Price=P;
  }
  void Update(float P) //Member Function 3
  {
    Price+=P;
  }
  void Display() //Member Function 4
  {
    cout<<Code<<”:”<<Title<<”:”<<Price<<endl;
  }
  ~BOOK()        //Member Function 5
  {
    cout<<”Book Discarded!”<<end1;
  }
};
void main()                    //Line 1
{                              //Line 2
  BOOK B,C(101,"Truth",350};   //Line 3
  for (int I=0;I<4;I++)        //Line 4
  {                            //Line 5
    B.Update(50);C.Update(20); //Line 6
    B.Display();C.Display();   //Line 7
  }                            //Line 8
}                              //Line 9  

(i) Which specific concept of object oriented programming out of the following is illustrated by member Function 1 and member Function 2 combined together?

  • Data Encapsulation
  • Polymorphism
  • Inheritance
  • Data Hiding

(ii) How many times the message ”Book Discarded!” will be displayed after executing the above C++ code? Out of Line 1 to Line 9, which line is responsible to display the message ”Book Discarded!”




Write the definition of a class CITY in C++ with following description:

Private Members

Ccode         //Data member for City Code (an integer)
CName      //Data member for City Name (a string)
Pop              //Data member for Population (a long int)
KM              //Data member for Area Coverage (a float)
Density      //Data member for Population Density (a float)
DenCal()   //A member function to calculate Density as Pop/KM

Public Members
Record()   //A function to allow user to enter values of Acode,Name,Pop,KM and call DenCal() function
View() //A function to display all the data members. Also display a message ”Highly Populated City”
if the Density is more than 10000




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

class ITEM
{
  int Id;
  char IName[20];
protected:
  float Qty;
public:
  ITEM();
  void Enter(); void View();
};
class TRADER
{
  int DCode;
protected:
  char Manager[20];
public:
  TRADER();
  void Enter();
  void View();
};
class SALEPOINT : public ITEM,private TRADER
{
  char Name[20],Location[20];
public :
  SALEPOINT();
  void EnterAll();
  void ViewAll();
};

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

-Single Level Inheritance
-Multi Level Inheritance
-Multiple Inheritance

(ii) Write the names of all the data members, which are directly accessible from the member functions of class SALEPOINT.

(iii) Write the names of all the member functions, which are directly accessible by an object of class SALEPOINT.

(iv) What will be the order of execution of the constructors, when an object of class SALEPOINT is declared?




Write the definition of a function FixSalary(float Salary[], int N) in C++, which should modify each element of the array Salary having N elements, as per the following rules:

Existing Salary Values Required Modification in Value
If less than 100000 Add 35% in the existing value
If >=100000 and <20000 Add 30% in the existing value
If >=200000 Add 20% in the existing value



R[10][50] is a two dimensional array, which is stored in the memory along the row with each of its element occupying 8 bytes, find the address of the element R[5][15], if the element R[8][10] is stored at the memory location 45000.




Write the definition of a member function DELETE() for a class QUEUE in C++, to remove a product from a dynamically allocated Queue of products considering the following code is already written as a part of the program.

struct PRODUCT
{
  int PID; char PNAME[20];
  PRODUCT *Next;
};
class QUEUE
{
  PRODUCT *R,*F;
public:
  QUEUE(){R=NULL;F=NULL;}
  void INSERT();
  void DELETE();
  ~QUEUE();
};



Write definition for a function DISPMID(int A[][5],int R,int C) in C++ to display the elements of middle row and middle column from a two dimensional array A having R number of rows and C number of columns.
For example, if the content of array is as follows:

215 912 516 401 515
103 901 921 802 601
285 209 609 360 172

The function should display the following as output
103 901 921 802 601
516 921 609




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

P/(QR)*S+T




Write function definition for DISP3CHAR() in C++ to read the content of a text file KIDINME.TXT, and display all those words, which have three characters in it.
Example: If the content of the file KIDINME.TXT is as follows:

When I was a small child, I used to play in the garden with my grand mom. 
Those days were amazingly funful and I remember all the moments of that time

The function DISP3CHAR() should display the following:

was the mom and all the



Write a definition for function ONOFFER( ) in C++ to read each object of a binary file TOYS.DAT, find and display details of those toys, which has status as “ÖN OFFER”. Assume that the file TOYS.DAT is created with the help of objects of class TOYS, which is defined below:

class TOYS
{
  int TID;char Toy[20],Status[20]; float MRP;
  public:
  void Getinstock()
  {
    cin>>TID;gets(Toy);gets(Status);cin>>MRP;
  }
  void View()
  {
    cout<<TID<<”:”<<Toy<<”:”<<MRP<<””:”<<Status<<endl;
  }
  char *SeeOffer() { return Status; }
};



Find the output of the following C++ code considering that the binary file CLIENT.DAT exists on the hard disk with a data of 1000 clients.

class CLIENT
{
  int Ccode;char CName[20];
  public:
  void Register();void Display();
};
void main()
{
  fstream CFile;
  CFile.open(“CLIENT.DAT”,ios::binary|ios::in);
  CLIENT C;
  CFile.read((char*)&C, sizeof(C));
  cout<<”Rec:”<<CFile.tellg()/sizeof(C)<<endl;
  CFile.read((char*)&C, sizeof(C));
  CFile.read((char*)&C, sizeof(C));
  cout<<”Rec:”<<CFile.tellg()/sizeof(C)<<endl;
  CFile.close();
}


Section-C


Observe the following PARTICIPANTS and EVENTS tables carefully and write the name of the RDBMS operation which will be used to produce the output as shown in RESULT ? Also, find the Degree and Cardinality of the result.

PARTICIPANTS

PNO NAME
1 Aruanabha Tariban
2 John Fedricks
3 Kanti Desai
EVENTS

EVENTCODE EVENTNAME
1001 IT Quiz
1002 Group Debate

RESULT

PNO NAME EVENTCODE EVENTNAME
1 Aruanabha Tariban 1001 IT Quiz
1 Aruanabha Tariban 1002 Group Debate
2 John Fedricks 1001 IT Quiz
2 John Fedricks 1002 Group Debate
3 Kanti Desai 1001 IT Quiz
3 Kanti Desai 1002 Group Debate



Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables

Table: VEHICLE

VCODE VEHICLETYPE PERKM
V01 VOLVO BUS 150
V02 AC DELUXE BUS 125
V03 ORDINARY BUS 80
V05 SUV 30
V04 CAR 18

Note: PERKM is Freight Charges per kilometer

Table: TRAVEL

CNO CNAME TRAVELDATE KM VCODE NOP
101 K.Niwal 2015-12-13 200 V01 32
103 Fredrick Sym 2016-03-21 120 V03 45
105 Hitesh Jain 2016-04-23 450 V02 42
102 Ravi Anish 2016-01-13 80 V02 40
107 John Malina 2015-02-10 65 V04 2
104 Sahanubhuti 2016-01-28 90 V05 4
106 Ramesh Jaya 2016-04-06 100 V01 25

Note:

  • Km is Kilometers travelled
  • NOP is number of passengers travelled in vehicle

(i) To display CNO, CNAME, TRAVELDATE from the table TRAVEL in descending order of CNO.

(ii) To display the CNAME of all the customers from the table TRAVEL who are traveling by vehicle with code V01 or V02.

(iii) To display the CNO and CNAME of those customers from the table TRAVEL who travelled between ’2015-12-31’ and ‘2015-05-01’.

(iv) To display all the details from table TRAVEL for the customers, who have travel distance more than 120 KM in ascending order of NOP.

(v) SELECT COUNT(*),VCODE FROM TRAVEL GROUP BY VCODE HAVING COUNT(*)>1;

(vi) SELECT DISTINCT VCODE FROM TRAVEL;

(vii) SELECT A.VCODE,CNAME,VEHICLETYPE
FROM TRAVEL A,VEHICLE B
WHERE A.VCODE=B.VCODE AND KM<90;

(viii) SELECT CNAME,KM*PERKM
FROM TRAVEL A,VEHICLE B
WHERE A.VCODE=B.VCODE AND A.VCODE=’V05′;




Verify the following using Boolean Laws.
X’+ Y’Z = X’.Y’.Z’+ X’.Y.Z’+ X’Y.Z+ X’.Y’.Z+ X.Y’.Z




Write the Boolean Expression for the result of the Logic Circuit as shown below:




Derive a Canonical SOP expression for a Boolean function G, represented by the following truth table:

A B C G(A,B,C)
0 0 0 1
0 0 1 0
0 1 0 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1



Reduce the following Boolean Expression to its simplest form using K-Map:
F(P,Q,R,S)= Σ(0,4,5,8,9,10,11,12,13,15)




Differentiate between PAN and LAN types of networks.




Which protocol helps us to transfer files to and from a remote computer?




Write two advantages of 3G over 2G Mobile Telecommunication Technologies in terms of speed and services?




Write two characteristics of Web 2.0.




What is the basic difference between Computer Worm and Trojan Horse?




Categories the following under Client side and Server Side script category?
(i) Java Script
(ii) ASP
(iii) VB Sript
(iv) JSP




Intelligent Hub India is a knowledge community aimed to uplift the standard of skills and knowledge in the society. It is planning to setup its training centers in multiple towns and villages pan India with its head offices in the nearest cities. They have created a model of their network with a city, a town and 3 villages as follows.

As a network consultant, you have to suggest the best network related solutions for their issues/problems raised in (i) to (iv), keeping in mind the distances between various locations and other given parameters.

Shortest distances between various locations:

VILLAGE 1 to YTOWN 2 KM
VILLAGE 2 to YTOWN 1.5 KM
VILLAGE 3 to YTOWN 3 KM
VILLAGE 1 to VILLAGE 2 3.5 KM
VILLAGE 1 to VILLAGE 3 4.5 KM
VILLAGE 2 to VILLAGE 3 3.5 KM
CITY Head Office to YHUB 30 KM

Number of Computers installed at various locations are as follows:

YTOWN 100
VILLAGE 1 10
VILLAGE 2 15
VILLAGE 3 15
CITY OFFICE 5

Note:
In Villages, there are community centers, in which one room has been given as training center to this organization to install computers. The organization has got financial support from the government and top IT companies.

(i) Suggest the most appropriate location of the SERVER in the YHUB (out of the 4 locations), to get the best and effective connectivity. Justify your answer.

(ii) Suggest the best wired medium and draw the cable layout (location to location) to efficiently connect various locations within the YHUB.

(iii) Which hardware device will you suggest to connect all the computers within each
location of YHUB?

(iv) Which service/protocol will be most helpful to conduct live interactions of Experts from Head Office and people at YHUB locations?



Total Marks.70