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.-2018-All India (CPP) siteicon No. of Q.28

Write the type of C++ tokens (keywords and user defined identifiers) from the following:
(i) else (ii) Long (iii) 4Queue (iv) _count




The following C++ code during compilation reports errors as follows:
Error: ‘ofstream’ not declared
Error: ‘strupr’ not declared
Error: ‘strcat’ not declared
Error: ‘FIN’ not declared
Write the names of the correct header files, which must be included to compile the code successfully:

void main()
{
  ofstream FIN("WISH.TXT");
  char TEXT2[]="good day";
  char TEXT1[]="John!";
  strupr(TEXT2);
  strcat(TEXT1, TEXT2);
  FIN<<TEXT1<<endl;
}



Rewrite the following C++ code after removing any/all syntactical errors with each correction underlined.
Note : Assume all required header files are already included in the program.

 

Typedef Count int;
void main()
{
  Count C;
  cout<<"Enter the count:";
  cin>>C;
  for (K = 1; K<=C; K++)
    cout<< C "*" K <<endl;
}



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

void Revert(int &Num, int Last=2)
{
  Last=(Last%2==0)?Last+1:Last-1;
  for(int C=1; C<=Last; C++)
  Num+=C;
}

void main()
{
  int A=20,B=4;
  Revert(A,B);
  cout<<A<<"&"<<B<<endl;
  B--;
  Revert(A,B);
  cout<<A<<"#"<<B<<endl;
  Revert(B);
  cout<<A<<"#"<<B<<endl;
}



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

 

#define Modify(N) N*3+10
void main()
{
  int LIST[]={10,15,12,17};
  int *P=LIST, C;
  for(C=3; C>=0; C--)
    LIST[I]=Modify(LIST[I]);
  for (C=0; C<=3; C++)
  {
    cout<<*P<<":";
    P++;
  }
}

 




Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it. Also, write the highest and lowest values that can be assigned in the array A.
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 A[4], C;
  for(C=0; C<4; C++)
  A[C]=random(C+1)+10;
  for(C=3; C>=0; C--)
  cout<<A[C]<<"@";
}

 

(i)   13@10@11@10@             (ii)   15$14$12$10$
(iii) 12@11@13@10@             (iv)  12@11@10@10@




Which function(s) out of the following can be considered as overloaded function(s) in the same program? Also, write the reason for not considering the other(s) as overloaded function(s).

void Execute(char A,int B); //Function 1
void Execute(int A,char B); //Function 2
void Execute(int P=10); //Function 3
void Execute(); //Function 4
int Execute(int A); //Function 5
void Execute(int &K); //Function 6




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

class FIRST
{
  int Num1;
  public:
  void Display() //Member Function 1
  {
    cout<<Num1<<endl;
  }
};
class SECOND: public FIRST
{
  int Num2;
  public:
  void Display() //Member Function 2
  {
    cout<<Num2<<endl;
  }
};
void main()
{
  SECOND S;
  ___________________ //Statement 1
  ___________________ //Statement 2
}

(i) Which Object Oriented Programming feature is illustrated by the definitions of
classes FIRST and SECOND?

(ii) Write Statement 1 and Statement 2 to execute Member Function 1 and Member
Function 2 respectively using the object S.




Write the definition of a class CONTAINER in C++ with the following description:
Private Members
– Radius,Height // float
– Type // int (1 for Cone,2 for Cylinder)
– Volume // float
– CalVolume() // Member function to calculate volume as per the Type

Type Formula to calculate Volume
Type 1 – 3.14*Radius*Height
Type 2 – 2 3.14*Radius*Height/3

Public Members
– GetValues() // A function to allow user to enter value of Radius, Height and Type. Also, call
function CalVolume() from it.
– ShowAll() // A function to display Radius, Height, Type and Volume of Container




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

class Teacher
{
  int TCode;
  protected:
  char Name[20];
  public:
  Teacher();
  void Enter(); void Show();
};
class Course
{
  int ID;
  protected:
  Char Title[30];
  public:
  Course();
  void Initiate();
  void Display();
};
class Schedule: public Course, private Teacher
{
  int DD,MM,YYYY;
  public:
  Schedule();
  void Start();
  void View();
};
void main()
{
  Schedule S;
}

(i) Which type of Inheritance out of the following is illustrated in the above example?
Single Level Inheritance, Multilevel Inheritance, Multiple Inheritance
(ii) Write the names of all the members, which are directly accessible by the member
function View() of class Schedule.
(iii) Write the names of all the members, which are directly accessible by the object S
of class Schedule declared in the main() function.
(iv) What will be the order of execution of the constructors, when the object S of class
Schedule is declared inside main() function?

 




Write the definition of a function SumEO(int VALUES[], int N) in C++, which should display the sum of even values and sum of odd values of the array separately.

Example: if the array VALUES contains
25 20 22 21 53

Then the functions should display the output as:
Sum of even values = 42 (i.e 20+22)
Sum of odd values = 99 (i.e 25+21+53)




Write definition for a function UpperHalf(int Mat[4][4]) in C++, which displays the
elements in the same way as per the example shown below.

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

25 24 23 22
20 19 18 17
15 14 13 12
10  9  8  7

The function should display the content in the following format:

25 24 23 22
20 19 18
15 14
10



Let us assume Data[20][15] is a two dimensional array, which is stored in the memory along the row with each of its element occupying 2 bytes, find the address of the element Data[10][5], if the element Data[15][10] is stored at the memory location 15000.




Write the definition of a member function AddPacket() for a class QUEUE in C++, to remove/delete a Packet from a dynamically allocated QUEUE of Packets considering the following code is already written as a part of the program.

struct Packet
{
  int PID;
  char Address[20];
  Packet *LINK;
};
class QUEUE
{
  Packet *Front, *Rear;
public:
  QUEUE(){Front=NULL;Rear=NULL;}
  void AddPacket();
  void DeletePacket();
  ~QUEUE();
};



Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion:
U * V + (W – Z) / X




A text file named MATTER.TXT contains some text, which needs to be displayed such that every next character is separated by a symbol ‘#’. Write a function definition for HashDisplay () in C++ that would display the entire content of the file MATTER.TXT in the desired format.
Example:
If the file MATTER.TXT has the following content stored in it:
THE WORLD IS ROUND
The function HashDisplay () should display the following content:
T#H#E# #W#O#R#L#D# #I#S# #R#O#U#N#D#




Write a definition for function TotalTeachers( ) in C++ to read each object of a binary file SCHOOLS.DAT, find the total number of teachers, whose data is stored in the file and display the same. Assume that the file SCHOOLS.DAT is created with the help of objects of class SCHOOLS, which is defined below:

 

class SCHOOLS
{
  int SCode; // School Code
  char SName[20]; // School Name
  int NOT; // Number of Teachers in the school
public:
  void Display()
  {cout<<SCode<<"#"<<SName<<"#"<<NOT<<endl;}
  int RNOT(){return NOT;}
};



Find the output of the following C++ code considering that the binary file SCHOOLS.DAT exists on the hard disk with the following records of 10 schools of the class SCHOOLS as declared in the previous question (4 b).

SCode SName NOT
1001 Brains School 100
1003 Child Life School 115
1002 Care Share School 300
1006 Educate for Life School 50
1005 Guru Shishya Sadan 195
1004 Holy Education School 140
1010 Rahmat E Talim School 95
1008 Innovate Excel School 300
1011 Premier Education School 200
1012 Uplifted Minds School 100

 

void main()
{
  fstream SFIN;
  SFIN.open("SCHOOLS.DAT",ios::binary|ios::in);
  SCHOOLS S;
  SFIN.seekg(5*sizeof(S));
  SFIN.read((char*)&S, sizeof(S));
  S.Display();
  cout<<"Record :"<<SFIN.tellg()/sizeof(S) + 1<<endl;
  SFIN.close();
}


Section-C


Observe the following tables VIDEO and MEMBER carefully and write the name of the RDBMS operation out of (i) SELECTION (ii) PROJECTION (iii) UNION (iv) CARTESIAN PRODUCT, which has been used to produce the output as shown below, Also, find the Degree and Cardinality of the final result.
TABLE: VIDEO

VNO VNAME TYPE
F101 The Last Battle Fiction
C101 Angels and Devils Comedy
C102 Daredevils Adventure

TABLE: MEMBER

MNO MNAME
M101 Namish Gupta
M102 Sana Sheikh
M103 Lara James

FINAL RESULT

VNO VNAME TYPE MNO MNAME
F101 The Last Battle Fiction M101 Namish Gupta
F101 The Last Battle Fiction M102 Sana Sheikh
F101 The Last Battle Fiction M103 Lara James
C101 Angels and Devils Comedy M101 Namish Gupta
C101 Angels and Devils Comedy M102 Sana Sheikh
C101 Angels and Devils Comedy M103 Lara James
A102 Daredevils Adventure M101 Namish Gupta
A102 Daredevils Adventure M102 Sana Sheikh
A102 Daredevils Adventure M103 Lara James



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

ANO ANAME ADDRESS
101 Nirja Singh Bangalore
102 Rohan Gupta Chennai
103 Ali Reza Hyderabad
104 Rishabh Jain Chennai
105 Simran Kaur Chandigarh

Table: TRANSACT

TRNO ANO AMOUNT TYPE DOT
T001 101 2500 Withdraw 2017-12-21
T002 103 3000 Deposit 2017-06-01
T003 102 2000 Withdraw 2017-05-12
T004 103 1000 Deposit 2017-10-22
T005 101 12000 Deposit 2017-11-06

(i) To display details of all transactions of TYPE Deposit from Table TRANSACT.

(ii) To display the ANO and AMOUNT of all Deposits and Withdrawals done in the month of October 2017 from table TRANSACT.

(iii) To display the last date of transaction (DOT) from the table TRANSACT for the Accounts having ANO as 103.

(iv) To display all ANO, ANAME and DOT of those persons from tables ACCOUNT and TRANSACT who have done transactions less than or equal to 3000.

(v) SELECT ANO, ANAME FROM ACCOUNT
WHERE ADDRESS NOT IN (‘CHENNAI’, ‘BANGALORE’);

(vi) SELECT DISTINCT ANO FROM TRANSACT;

(vii) SELECT ANO, COUNT(*), MIN(AMOUNT) FROM TRANSACT
GROUP BY ANO HAVING COUNT(*)> 1;

(viii) SELECT COUNT(*), SUM(AMOUNT) FROM TRANSACT
WHERE DOT <= ‘2017-06-01’;




State any one Absorption Law of Boolean Algebra and verify it using truth table.




Draw the Logic Circuit of the following Boolean Expression:
(U’+V).(V’+W’)




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

X Y Z FN(X,Y,Z)
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1



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

G(U,V,W,Z) = Σ (3,5,6,7,11,12,13,15)

 




Differentiate between Bus Topology and Star Topology of Networks. What are the advantages and disadvantages of Star Topology over Bus Topology?




Classify each of the following Web Scripting as Client Side Scripting and Server Side Scripting:
(i) JavaScripting (ii) ASP (iii) VB Scripting (iv) JSP




Write the expanded names for the following abbreviated terms used in Networking and Communications:
(i) SMTP (ii) VoIP (iii) GSM (iv) WLL




CASE STUDY BASED QUESTION:

Ayurveda Training Educational Institute is setting up its centre in Hyderabad with four specialised departments for Orthopedics, Neurology and Pediatrics along with an administrative office in separate buildings. The physical distances between these department buildings and the number of computers to be installed in these departments and administrative office as given as follows. You as a network expert have to answer the queries as raised by them in (i) to (iv).

Shortest distances between various locations in metres:

Administrative Office to Orthopedics Unit 55
Neurology Unit to Administrative Office 30
Orthopedics Unit to Neurology Unit 70
Pediatrics Unit to Neurology Unit 50
Pediatrics Unit to Administrative Office 40
Pediatrics Unit to Orthopedics Unit 110

Number of Computers installed at the various locations are as follows:

Pediatrics Unit 40
Administrative Office 140
Neurology 50
Orthopedics Unit 80

(i) Suggest the most suitable location to install the main server of this institution to get efficient connectivity.

(ii) Suggest the best cable layout for effective network connectivity of the building having server with all the other buildings.

(iii) Suggest the devices to be installed in each of these buildings for connecting computers installed within the building out of the following:
-Gateway
-Modem
-Switch

(iv) Suggest the topology of the network and network cable for efficiently connecting each computer installed in each of the buildings out of the following:
Topologies : Bus topology, Star Topology
Network Cable: Single Pair Telephone Cable, Coaxial Cable, Ethernet Cable



Total Marks.70