Advertisement

Short Answer Type

Give the difference between the Type Casting and automatic Type Conversion. Also, give a suitable C++ code to illustrate both.

86 Views

Find the output of the following program:

#include<iostream.h>
class METRO
{
	int Mno, TripNo,PassengerCount;
public:
	METRO (int Tmno=1)
	{
		Mno=Tmno;TripNo=0;PassengerCount=0;
	}
	void Trip(int PC=20)
	{
		TripNo++;PassengerCount+=PC;
	}
	void StatusShow()
	{
		cout<<Mno<<':'<<TripNo<<':'<<PassengerCount<<endl;
	}
};
	void main()
	{
		METRO M(5),T;
		M.Trip();
		T.Trip(50);
		M.StatusShow();
		M.Trip(30);
		T.StatusShow();
		M.StatusShow();
	
	}

113 Views

Observe the following program and find out, which output(s) out of(i) to(iv) will not be expected from the program? What will be the minimum and the maximum value assigned to the variable chance?

#include<iostream.h>
#include<stdlib.h>
void main( )
{
	randomize( );
	int Arr[]={9,6},N;
	int Chance=random(2)+10;
	for (int C=0;C<2;C++)
	{
		N=random(2);
		cout<<Arr[N]+Chance<<'#';
	}
}

(i) 9#6#   (ii) 19#17#  (iii) 19#16#   (iv) 20#16#

103 Views

Multiple Choice Questions

Which out of the following comes under Cyber Crime?

  • Operating someone’s internet banking account, without his knowledge.

  • Stealing a keyboard from someone’s computer.

  • Working on someone’s computer with his/her permission.

82 Views

Advertisement

Short Answer Type

Find the output of the following program:

#include<iostream.h>
#include<c.type.h>
typeof char Str80[80];
void main()
{
	char*Notes;
	Str80 Str='vR2GooD':
	int L = 6;
	Notes =Str;
	while(L>=3)
	{
		Str[L]=(isupper(Str[L])?tolower(Str[L]):toupper(Str[L]));
		cout<<Notes<<endl;
		L--;
		Notes++;
	}
}

80 Views

Answer the question (i) and (ii) after going through the following class :

class Travel
{
	int PlaceCode; char Place[20]; float Charges; public:
Travel( )	//Function 1
{
	PlaceCode=1;strcpy(Place,'DELHI');Charges=1000;
}
void TravelPlan(float C )	// Function 2
{
	cout<<PlaceCode<<':'<<Place<<':'<<Charges<<endl;
}
~Travel( )	// Function 3
{
	cout<<'Travel Plan Cancelled'<<endl;
}
Travel(int PC,char p[],float C)	// Function 4
{
	PlaceCode=PC;strcpy(Place,P);Charges=c;
}

(i) In Object Oriented Programming, what are Function 1 and Function 4 combined together referred as?

(ii) In Object Oriented Programming, which concept is illustrated by Function 3? When is this function called/invoked?

82 Views

What is the difference between the members in private visibility mode and the members in protected visibility mode inside a class? Also, give a suitable C++ code to illustrate both.

88 Views

Rewrite the following program after removing the syntactical error(s) (if any). Underlie each correction.

#include<iostream.h>
Class Item
{
	long IId,Qty;
public:
	void Purchase
	{
		cin>>IId>>Qty;
	}
}	void Sale()
{
	cout<<setw(5)<<IId<<'Old:'<<Qty<<endl;
	cout<<'New:'<<--Qty<< endl;
}
void main()
{
	Item I;
	Purchase();
	I.Sale();
	I.Sale(0)
}

76 Views

Advertisement

Which C++ header file(s) are essentially required to be included to run/execute the following C++ source code (Note: Do not include any header file, which is/are not required);

Void main()
{
	char TEXT[] = 'SomeThing';
	cout<<'Remaining SMS Chars:'
	<<160-strlen(TEXT)<< endl;
}

72 Views

Multiple Choice Questions

What out of the following, will you use to have an audio-visual chat with an expert sitting in a faraway place to fix-up a technical issue?

  • VoIP

  • email

  • FTP

204 Views