Sunteți pe pagina 1din 2

[INSTRUCTION:-Candidates are required to give their answers in their own words as far as (f) Write a program in c++ to find

ind sum of following series- 2


practicable.]
S=1+2+3+.+n
1. (a) What is the difference between Global Variable and Local Variable? 2
(b) Write the names of the header files to which the following belong: 1 2.) (a) What do you understand by Data Encapsulation and Data Hiding? 2
(i) strcmp() (ii) fabs() (b) Answer the questions (i) and (ii) after going through the
(c) Rewrite the following program after removing the syntactical errors (if any). following class: 2
Underline each correction. 2 class Seminar
#include [iostream.h] {
int Time;
class MEMBER
public:
{
Seminar() //Function 1
int Mno;float Fees;
{
PUBLIC
Time=30;
void Register(){cin>>Mno>>Fees;} cout<<Seminar starts now<<end1;
void Display{cout<<Mno<<" : "<<Fees<<endl;} }
}; void Lecture() //Function 2
void main() {
{ cout<<Lectures in the seminar on<<end1;
MEMBER M; }
Register(); Seminar(int Duration) //Function 3
M.Display(); {
} Time=Duration;
(d) Find the output of the following program: 3 cout<<Seminar starts now<<end1;
#include <iostream.h> }
void main() ~Seminar() //Function 4
{ {
cout<<Vote of thanks<<end1;
int v1=5, v2=10; }
for (int x=1; x<=2; x++) };
{ i) In Object Oriented Programming, what is Function 4 referred as and when does
cout<<++v1<< \t<<v2--<<endl; it get invoked/called?
cout<< --v2<< \t<<v1++<<endl; ii) In Object Oriented Programming, which concept is illustrated by
} Function 1 and Function 3 together? Write an example illustrating the calls
} for these functions.
(e) Find the output of the following program: 2 c.)Define a class Candidate in c++ with the following description :
#include<iostream.h> Private members- 4(1+1+1+1)
#include<conio.h> i.)A data member RNo (Registration Number) of type long
#include<string.h> ii.)A data member Name of type string
void main() iii)A data member score of type float
{ iv) A data member Remarks of type string
clrscr(); v)A member function AssignRem() to assign Remarks as per the Score obtained
char *s=SANTOSHVERMASIR; by a candidate. Score range and the respective Remarks are shown as follows:
for( int i=0; str[i]!=\0; i++ ) Score Remarks
{
>=50 Selected
for( int j=0; j<=i; j++ )
Less than 50 Not selected
cout<<str[j];
Public members-
cout<<endl;
A function ENTER() to allow user to enter values for RNo, Name, Score and
getch();
call function AssignRem() to assign the remarks.
}
A function DISPLAY() to allow user to view the content of all the data
}
members.
(d) Answer the questions (i) to (iv) based on the following: 4(1+1+1+1)
class CUSTOMER
{
int Cust_no;
char Cust_Name[20];
protected:
void Register();
public:
CUSTOMER();
void Status();
};
class SALESMAN
{
int Salesman_no;
char Salesman_Name[20];
protected:
TEST EXAMINATION
float Salary;
public: CLASS:12th
SALESMAN();
void Enter();

};
void Show(); BY:SANTOSH VERMA SIR
class SHOP : private CUSTOMER , public Mob.: 9430706774, 8757777836
SALESMAN
{ Units :(i)Programming in C++ (ii)Data Structure.
char Voucher_No[10];
char Sales_Date[8]; Students Name.. Full Marks : 66
public:
SHOP(); College................................... Pass Marks : 22
void Sales_Entry();
void Sales_Detail(); Roll no. Batch Time. Time : 120 min.
}; Date
(i) Write the names of data members which are
accessible from objects belonging to
class CUSTOMER.
(ii) Write the names of all the member
functions which are accessible from GENERAL INSTRUCTIONS :
objects belonging to class SALESMAN.
(iii)Write the names of all the members which (i) All the questions are compulsory.
are accessible from member functions (ii) Programming Language: C++
of class SHOP.
(iv) How many bytes will be required by an
(iii) Marks for each question are indicated against it
object belonging to class SHOP?
3.)a) Write a program for decalring and calling of function
inside main and defining outside the main (). 4(1+1+1+1)
b) WAP in c++ which accepts the two matrix of the sum and display the sum
of particular matrics. 4(1+1+1+1)
c) Write an Algorithm to insert an ITEM in a QUEUE implemented as an
array. 4 (1+1+1+1)
d) Evaluate the following postfix notation of expression: 2
20,30,+,50,40,-,*
e) WAP in c++ to show Input and Display the matrix using an Array. 2
4.) a) Give syntax to define a structure. 1
b) Swapping of two numbers using function call by value. 2
c) What is difference b/w Stack and Queue? 3( + )

S-ar putea să vă placă și