Subject

Computer and Communication Technology

Class

CBSE Class 12

Pre Boards

Practice to excel and get familiar with the paper pattern and the type of questions. Check you answers with answer keys provided.

Sample Papers

Download the PDF Sample Papers Free for off line practice and view the Solutions online.
Advertisement

 Multiple Choice QuestionsShort Answer Type

Advertisement

11.

Define a class RESTRA in C++ with following description: Private Members:

  • FoodCode of type int
  • Food of type string
  • FType of type string
  • Sticker of type string

A member function GetSticker() to assign the following values for Sticker as per the given Ftype:

FType

Sticker

Vegetarian

GREEN

Contains Egg

YELLOW

Non-Vegetarian

RED

Public Members :

  • A function GetFood() to allow user to enter values for FoodCode, Food,Ftype and call function GetSticker() to assign
  • A function ShowFood() to allow user to view the concept of all the data members.


class RESTRA
{
	int FoodCode;
	char Food[20];
	char FType[20];
	char Sticker[20];
	void GetSticker();
public:
	void GetFood();
	void ShowFood();
};
void RESTRA::GetFood()
{
	cin>>FoodCode;
	cin>>Food;
	cin>>FType;
	GetSticker ();
}
void RESTRA:: GetSticker ()
{
	if (strcmp(FType,'Vegetarian'))
		strcpy(Sticker,'GREEN');
	else if (strcmp(FType,'Contains Egg'))
		strcpy(Sticker,'YELLOW');
	else if(strcmp(FType,'Non-Vegetarian'))
		strcpy(Sticker,'RED');
}
void RESTRA:: ShowFood ()
{
	cout<< FoodCode <<'\t'<<Food<<'\t'<<FType<<'\t'<<Sticker<<endl;
}
173 Views

Advertisement
12.

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

class COMPANY
{
	char Location[20]; double Budget,Income;
protected:
	void Accounts( ); public:
	COMPANY();
	void Register( ); void Show( );
};
class FACTORY: public COMPANY
{
	char Location[20];
	int Workers;
protected:
	double Salary;
	void Computer();
public:
	FACTORY();
	void Enter( );
	void show( );
};
class SHOP: private COMPANY
{
	char Location[20];
	float Area;
	double Sale;
public:
	SHOP();
	void Input();
	void Output();
};

(i) Name the type of inheritance illustrated in the above C++ code.

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

(iii) Write the names of all the member functions, which are accessible from objects belonging to class FACTORY.

(iv) Write the names of all the members, which are accessible from objects of class SHOP.

77 Views

13.

Write a function SWAP2BEST (int ARR[], int Size) in C++ to modify the content of the array in such a way that the elements, which are multiples of 10 swap with the value present in the very next position in the array.

For example:

If the content of array ARR is 90,56,45,20,34,54

The content of array ARR should become 56,90,45,34,20,54

71 Views

14.

An array T[20][10] is stored in the memory along the column with each of the element occupying 2 bytes, find out the memory location of T[10][5], if an element T[2][9] is stored at location 7600.

74 Views

Advertisement
15.

Write a function ALTERNATE (int A[][3],int N,int M) in C++ to display all alternate element from two-dimensional array A (starting from A[0][0]).
For example:
If the array is containing:

23 54 76
37 19 28
62 13 19

The output will be:

23 76 19 62 19

82 Views

16.

Observe the program segment given below carefully and the question that follow:

class Stock
{
	int	Ino,Qty; char Item[20];
public:
	void Enter() {cin>>In0;gets(Item); cin>>Qty;}
	void Issue(int Q) { Qty+=Q}
	void Purchase(int Q) { Qty-=Q}
	int GetIno(return Ino;)
};
void Purchaseitem(int Pino, int PQty)
{
	fstream file;
	File.open("STOCK.DAT",ios::binary|ios::in|ios::out);
	Stock S;
	int Success=0;
	while (Success==0 && File.read((char*)&S, sizeof(S)))
	{
		if (Pino==S.GetIno())
		{
			S.Purchase(PQty);
			File.seekp(Success);	            //Statement 1
			File.write((char*) &S, sizeof(S));	//statement 2
		Success++;
	}
}
	if (Success==1)
		cout<<"Purchase Updated"<<endl;
	else
		cout<<"Wrong Item No"<<endl;
	File.close( );
}

(i) Write statement 1 to position the file pointer to the appropriate place, so that the data updation is done for the required item.
(ii) Write statement 2 to perform the write operation so that the updation is done in the binary file.

60 Views

17.

Write a function in C++ to read the content of a text file 'DELHI.TXT' and display all those lines on the screen, which are either starting with ‘D’ or starting with ‘M’.

76 Views

18.

Write a function in C++ to search for the details (Phoneno and Calls) of those Phones, which have more than 800 calls from a binary file “phones.dat”. Assuming that this binary file contains records/objects of class Phone, which is defined below.

class Phone
{
	char Phoneno[10]; int Calls; 
public:
	void Get( ) 
	{ 
		gets(Phoneno); cin>>Calls; 
	}
	void Billing( )
	{
		cout<<Phoneno<<'#'<<Calls<<endl;
	}
	int GetCalls( )
	{
		return Calls;
	}
};

78 Views

Advertisement
19.

Give a suitable example of a table with sample data and illustrate Primary and Alternate Keys in it.

52 Views

20.

Consider the following tables CARDEN and CUSTOMER and answer (b) and (c) parts of question:

TABLE: CARDEN

Ccode

CarName

Make

Color

Capacity

Charges

501

A-Star

Suzuki

RED

3

14

503

Indigo

Tata

SILVER

3

12

502

Innova

Toyota

WHITE

7

15

509

SX4

Suzuki

SILVER

4

14

TABLE: CUSTOMER

CCode

Cname

Ccode

1001

Hemant Sahu

501

1002

Raj Lal

509

1002

Feroza Shah

503

1004

Ketan Dhal

502

Write SQL commands for the following statements:

  1. To display the names of all the silver colored
  2. To display name of car, make and capacity of cars in descending order of their sitting
  3. To display the highest charges at which a vehicle can be hired from
  4. To display the customer name and the corresponding name of the cars hired by them

54 Views

Advertisement