Questions – Exam Papers – Computer Sir Ki Class

Login


Lost your password?

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


Shop
siteicon
Exam Paper: Questions - Exam Papers (CPP) siteicon No. of Q.31

What is the role of a parameter/argument passed in a function? Can a default value be assigned to a parameter(Yes/No)? If yes, justify your answer with the help of a suitable example otherwise give reason.




Raman suggests Kishan the following header files which are required to be included in the given C++ program. Identify the header files which are wrongly suggested by Raman.

Program:

void main()
{
char Grade;
cin.get(Grade);
if(isalpha(Grade))
   cout.put(Grade);
}

Suggested header files:-
1. iostream.h
2. stdio.h
3. conio.h
4. ctype.h




Rewrite the following program after removing the syntactical errors (if any). Underline each correction.

#include<iostream.h>
#include<conio.h>
Typedef int Num;
Num full=100;
Num Calc(int X)
{
full=(X>2)?1:2;
return (full%2)
}
void main
{
int full = 1000;
full =Calc(::full);
cout<<::full<<"::">>full>>endl;
}




Write the output of the following C++ program code (assume all necessary header files are included in program) :

 

void Encrypt(char *S, int key)
{
  char *Temp=S;
  if(key%2==0)
  { key--; }
  while (*Temp!='\0')
  {
    *Temp+=key;
    Temp+= key;
  }
}
void main()
{
  int Key_Set[]={1,2,3};
  char Pvt_Msg[]="Computer2017";
  for(int C=0; C<2; C++)
  {
  Encrypt(Pvt_Msg, Key_Set[C]);
  cout<<"New Encrypted Message after Pass "<<C+1<<" is : "<<Pvt_Msg;
  cout<<endl;
}
}

 




Write the output of the following C++ program code(assume all necessary header files are included in program):

struct Ticket
{
char Level;
int Price;
};
void Compute(Ticket &T)
{
if (T.Level==’A’)
T.Price+=50;
else if (T.Level==’B’)
T.Price+=30;
else if (T.Level==’C’)
T.Price+=25;
cout<=0;)
{
Compute(Mon_Show[count–]);
}
}




Consider the following C++ program code and choose the option(s) which are not possible as output. Also, print the minimum & maximum value of variable Pick during complete execution of the program.(assume all necessary header files are included in program):

const int NUM=5;
void main()
{
  randomize();
  int V1=1, V2=5, Pick;
  while(V1<V2)
  {
    Pick = random(NUM) + (V2-V1);
    cout<<Pick<<":";
    V1++;
  }
}

 

(a) 5:6:6:6:
(b) 4:7:5:3:
(c) 8:6:1:2:
(d) 7:5:3:1




What do you mean by Data Abstraction in OOPs? Explain its significance with a suitable example.




Answer the question (i) & (ii) after going through the following code. (assume all necessary header files are included in program):-

class Game
{
char Name [21];
int No_of_Players;
public:
  Game()          //Function 1
  {
     strcpy(Name, "Cricket");
     No_of_Players=11;
     cout<<"New Game Starts\n";
  }
  Game(char N[], int No) //Function 2
  { 
  strcpy(Name, N);
  No_of_Players=No;
  cout<<Name<<"comprises"<<No_of_Players<<"number of players\n";
  }
  ~Game()   //Function 3
  {
    cout<<"Game Ends\n";
  }
};

(i) Give the name of the feature of OOP which is implemented by Function 1 & 2 together in the above class Game.
(ii) Anuj made changes to the above class Game and made Function 3 private. Will he be able to execute the Line 1 successfully given below? Justify.
void main()
{
Game ABC; //Line 1
}




Define a class Bill in OOP with the following specification:-
Private members:
1. Bill_no – type long(bill number)
2. Bill_period – type integer(number of months)
3. No_of_calls – type integer(number of mobile calls)
4. Payment_mode – type string(“online” or “offline”)
5. Amount – type float(amount of bill)
6. Calculate_Bill() function to calculate the amount of bill given as per the following conditions:

No_of_calls Calculation Rate/call
(in rupees)
<=500 1.0
501-1200 2.0
>1200 4.0

Also, the value of Amount should be reduced by 5% if Payment_mode is “online”.
Public members:
1. A member function New_Bill() that will accept the values for Bill_no, Bill_period, No_of_calls, Payment_mode from the user and invoke Caluclate_Bill() to assign the value of Amount.
2. A member function Print_Bill() that will display all details of a Bill.




Answer the question from (i) to (iv) based on the given below code
(assume all necessary header files are included in program):-

class City
{
  int City_Id;
  char City_Name[30];
protected:
  int City_Population;
public:
  City();
  void Get_Population();
  void New_City();
  void Show_City;
};
class State : public City
{
  int State_Id;
  char State_Name[25];
protected:
  int State_Population;
public:
  State();
  void New_State();
  void Print_State();
};
class Country : private State
{
  int Country_Id;
  char Country_Name[25];
public;
  Country();
  void New_Country();
  void Display_Country();
};

 

(i) Write name of the class whose constructor is invoked first on the creation of a new object of class Country.
(ii) Write name of the data members which are accessible through the object of class Country.
(iii) List name of the members which are accessible through the member function “void New_Country()”.
(iv) What will be the size(in bytes) of an object of class Country & State respectively.




Write the definition of function named Array_Swap() that will accept an integer array & its size as arguments and the function will interchange/swap elements in such a way that the first element is swapped with the last element, second element is swapped with the second last element and so on, only if anyone or both the elements are odd.
E.g. if initially array of seven elements is:
5, 16, 4, 7, 19, 8, 2
After execution of the above function, the contents of the array will be:
2,16, 19, 7, 4, 8, 5




An array A[50][30] is stored along the row in the memory with each element requiring 4 bytes of storage. If the element A[10][15] is stored at 21500, then find out the base address of the array and the memory address of element stored at location A[30][25]?




Write the definition of a member function Q_Insert() for a class Exam_Queue in C++ to insert a new Application information in a dynamically allocated queue whose code is already given below as a part of the program(assume all necessary header files are included in program):

struct Application
{
  int App_Id;
  char App_Name[21];
  Application *Link;
};
class Exam_Queue
{
  Application *Front, *Rear;
public;
  Exam_Queue()   //Constructor
  {
  Front=Rear=NULL;
  }
  void Q_Insert ();
  void Q_Delete();
};




Write the definition of a user-defined function REPEAT_ROW(int A[][3],int R, int C) in C++ that will store the elements in the following manner
1. All row elements except the 1st element replaced by the 1st element,
2. All row elements except the 1st & 2nd element replaced by the 2nd element,
3. All row elements except the 1st , 2nd & 3rd element replaced by the 3rd element and so on.
For example: if initially the array was:-

5 6 10 2
2 6 9 12
18 14 5 6

Then, the contents of the array after execution of the above function will be:-

5 5 5 5
2 6 6 6
18 14 5 5



Evaluate the following POSTFIX expression. Show the status of Stack after execution of each operation separately:
TRUE, FALSE, OR, NOT, TRUE, FALSE, AND, OR




Answer the questions (i) & (ii) in the program segment given below for the required task.

class Route
{
  int Route_No;        //Route Number
  char Route_name[21]; //Name of Route
  int No_Kms;          // Distance in kms on Route
public;
  void New_Route();    // Accepts details of new Route
  void Show_Route();   // Display details of a Route
  int Get_RouteNo();   //Return the Route Number
  {  return Route_No;  }
void Update_Kms(int K)
  { No_Kms=K;}
};
void Update_Route(int No, int New_Kms) //Update No_Kms of a Route
{
  Route R;
  fstream File("ROUTE.DAT" , ios::in | ios::out | ios::binary);
  while(!File.eof())
  {
    File.read((char*)&R, sizeof(R));
    if(( R.Get_RouteNo()==No))
    { R.update_Kms(New_Kms);
    ___________________   //Statement 1
    ___________________   //Statement 2
    cout<<"Route Details updated\n";
  }
}
File.close();
} 

 

(i) Write Statement 1 to position the file pointer to the appropriate place so that the data updation is done for the correct Route.
(ii) Write Statement 2 to perform the write operation so that the updation is done in the binary file “ROUTE.DAT”.




Write a user-defined function named Count() that will read the contents of text file named “Report.txt” and display the count of the number of lines that start with either „I. or „M..
E.g. In the following paragraph, there are 3 lines starting with „I. or „M.:
“India is the fastest growing economy.
India is looking for more investments around the globe.
The whole world is looking at India as a great market.
Most of the Indians can foresee the heights that India is capable of reaching.”


void



Consider the following class Item:-

class Item
{
  int ItemId;
  int Quantity;
  float Price;
public:
  void NewItem()
  {
    cin>>ItemId>>Quantity>>Price;
  }
void ShowItem()
  {
    cout<<ItemId<<":"<<Quantity<<":"<<Price<<endl;
  }
void Set_Price(float P)
  { Price=P;
  int Ret_Id()
  { return ItemId; }
};

Write a function named Change_Item(int Id, float Pr) to modify the price of the item whose Itemid & new price are passed as an argument.



Section-C


Differentiate between DDL & DMLcommands. Identify DDL & DML commands from the following:-
(UPDATE, SELECT, ALTER, DROP)




Consider the following relations MobileMaster & MobileStock:-

MobileMaster

M_Id M_Id
M_Company
M_Name M_Price M_Price
M_Mf_Date
MB001 Samsung Galaxy 4500 2013-02-12
MB003 Nokia N1100 2250 2011-04-15
MB004 Micromax Unite3 4500 2016-10-17
MB005 Sony XperiaM 7500 2017-11-20
MB006 Oppo SelfieEx 8500 2010-08-21
106 MANIPRABHA CHENNAI 2001-12-12 69000

MobileStock

MobileMaster

S_Id M_Id M_Qty M_Supplier
S001 MB004 450 New Vision
S002 MB003 250 Praveen Gallery
S003 MB001 300 Classic Mobile Store
S004 MB006 150 A-one Mobiles
S005 MB003 150 The Mobile
S006 MB006 50 Mobile Centre

 

Write the SQL query for questions from (i) to (iv) & write the output of SQL command for questions from (v) to (viii) given below:-
(i) Display the Mobile company, Mobile name & price in descending order of their manufacturing date.
(ii) List the details of mobile whose name starts with „S..
(iii) Display the Mobile supplier & quantity of all mobiles except „MB003..
(iv) To display the name of mobile company having price between 3000 & 5000.
(v) SELECT M_Id, SUM(M_Qty) FROM MobileStock GROUP BY M_Id;
(vi) SELECT MAX(M_Mf_Date), MIN(M_Mf_Date) FROM MobileMaster;
(vii) SELECT M1.M_Id, M1.M_Name, M2.M_Qty, M2.M_Supplier FROM MobileMaster M1, MobileStock M2 WHERE M1.M_Id=M2.M_Id AND M2.M_Qty>=300;
(viii) SELECT AVG(M_Price) FROM MobileMaster;




State & prove De-Morgan‟s law using truth table.




Draw the equivalent logic circuit diagram of the following Boolean expression:-
(A‟ + B).C’




Write the SOP form for the Boolean Function F(X,Y,Z) represented by the given truth table:-

X Y Z F
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1



Reduce the following Boolean expression using K-Map:-
F(U,V,W,Z)= ð(0,2,5,7,12,13,15)




A teacher provides “http://www.XtSchool.com/default.aspx” to his/her students to identify the URL & domain name.




Which out of the following does not come under Cyber Crime?
(i) Copying data from the social networking account of a person without his/her information & consent.
(ii) Deleting some files, images, videos, etc. from a friend‟s computer with his consent.
(iii) Viewing & transferring funds digitally from a person‟s bank account without his/her knowledge.
(iv) Intentionally making a false account on the name of a celebrity on a social networking site.




Expand the following:-
1. GSM 2. TDMA




What is the significance of cookies stored on a computer?




Kabir wants to purchase a Book online and placed the order for that book using an e-commerce website. Now, he is going to pay the amount for that book online using his Mobile, he needs which of the following to complete the online transaction:-
1. A bank account,
2. A Mobile connection/phone which is attached to above bank account,
3. The mobile banking app of the above bank installed on that mobile,
4. Login credentials(UserId & Password) provided by the bank,
5. All of above.




What do you mean by data encryption? For what purpose it is used for?




Sanskar University of Himachal Pradesh is setting up a secured network for its campus at Himachal Pradesh for operating their day-to-day office & web based activities. They are planning to have network connectivity between four buildings. Answer the question (i) to (iv) after going through the building positions in the campus & other details which are given below:

The distances between various buildings of university are given as:-

Building 1 Building 2 Distance(in mtrs.)
Main Admin 50
Main Finance 100
Main Academic 70
Admin Finance 50
Finance Academic 70
Admin Academic 60

Number of computers:-

Building No. of Computers
Main 150
Admin 75
Finance 50
Academic 60

As a network expert, you are required to give best possible solutions for the given queries of the university administration:-
(a) Suggest cable layout for the connections between the various buildings,
(b) Suggest the most suitable building to house the server of the network of the university,
(c) Suggest the placement of following devices with justification:
1. Switch/Hub
2. Repeater
(d) Suggest the technology out of the following for setting-up very fast Internet connectivity among buildings of the university
1. Optical Fibre
2. Coaxial cable
3. Ethernet Cable

 

 



Total Marks.70