Advertisement Remove all ads

Important Questions for CBSE (Science) Class 12 - CBSE - Computer Science (C++)

Advertisement Remove all ads
Subjects
Topics
Subjects
Popular subjects
Topics
Computer Science (C++)
< prev 21 to 40 of 96 next > 

Write the definition of a class BOX 1n C++ with the following description

Private Members

- BoxNumber //data member of integer type

- Side           // data member of float type

- Area          // data member of float type

- ExecArea ()  // Member function to calculate and assign Area as Side * Side

Public Members

- GetBox()   // function to allow user to enter values of BoxNumber and Side. Also, this

                  // function should call ExecArea () to calculate Area

- Showbox ()  //  A function to display BoxNumber , Side and Area

Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Using Private and Public Visibility Modes, Default Visibility Mode (Private)

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

class First
{
    int X1;
protected:
    float X2;
public:
    First();
    void Enter1(); void Display1;
};

class Second: private First
{
    int Y1;
protected:
    float Y2;
public:
    Second();
    void Enter2();
    void Display();
};

class Third : public Second
{
    int Z1;
public:
    Third{);
    void Enter3();
    void Display{);
};

void main()
{
    Third T;  //Statement 1·
    __________;  // Statement 2
}

1) Which type of Inheritance out of the following is illustrated in the above example?

Single Level Inheritance, Multilevel Inheritance, Multiple Inheritance

2) Write the names of all the member functions, which are directly accessible by the object T of class Third as declared in main() function.

3) Write Statement 2 to call function Display() of class Second from the object T of class Third

4) What will be the order of execution of the constructors, when the object T of class Third is declared inside main()?

Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Inheritance in C++

Write the definition of a function AddUp(int Arr[], int N) in C++, in which all even positions (i.e., 0,2,4, ... ) of the array should be added with the content of the element in the next position and odd positions (i.e., 1,3,5, ... ) elements should be incremented by 10

Example: if the array Arr contains

23 30 45 10 15 25

Then the array should become

53 40 55 20 40 35

Note:

  • The function should only alter the content in the same array.
  • The function should not copy the altered content in another array.
  • The function should not display the altered content of the array.
  • Assuming, the Number of elements in the array are Even.
Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Pointers and Arrays - Array of Pointers, Pointer to an Array (1 Dimensional Array), Function Returning a Pointer, Reference Variables and Use of Alias

Write a definition for a function SUMMIDCOL(int MATRIX [10], int N, int M) in C++, which finds the sum of the middle column's elements of the MATRIX (Assuming N represents a number of rows and M represents the number of columns, which is an odd integer). 
Example: If the content of array MATRIX having N as 5 and M as 3 is as follows

1 2 1
2 1 4
3 4 5
4 5 3
5 3 2

The function should calculate the sum and display the following :

Sum of Middle Column: 15

Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Pointers and Arrays - Array of Pointers, Pointer to an Array (1 Dimensional Array), Function Returning a Pointer, Reference Variables and Use of Alias

Write the definition of a member function PUSHGIFT() for a class STACK in C++, to add a GIFT in a dynamically allocated stack of GIFTs considering the following code is already written as a part of the program

struct GIFT
{
    int GCODE;           //Gift Code
    char GDESC[20];      //Gift Description
    GIFT *Link;
};
class STACK
{
    Gift *TOP;
public:
    STACK(){TOP=NULL;}
    void PUSHGIFT{);
    void POPGIFT();
    ~STACK();
};
Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Member of a Class - Data Members and Member Functions (Methods)

Polina Raj has used a text editing software to type some text in an article. After saving the article as MYNOTES.TXT, she realised that she has wrongly typed alphabet K in place of alphabet C everywhere in the article.

Write a function definition for PURETEXT() in C++ that would display the corrected version of the entire article of the file MYNOTES.TXT with all the alphabets "K" to be displayed as an alphabet "C" on screen.

Note: Assuming that MYNOTES.TXT does not contain any c alphabet otherwise

Example:

If Polina has stored the following content in the file MYNOTES.TXT

I OWN A KUTE LITTLE KAR

I KARE FOR IT AS MY KHILD

The function PURETEXT() should display the following content

I OWN A CUTE LITTLE CAR

I CARE FOR IT AS MY CHILD.

Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Function Call by Reference

Write a definition for function COUNTPICS() in C++ to read each object of a binary file PHOTOS.DAT, find and display the total number of PHOTOS of type PORTRAIT. Assume that the file PHOTOS.DAT is created with the help of objects of class PHOTOS, which is defined below :

class PHOTOS
{
   int PCODE ;
   char PTYPE[20]; //Photo Type as "PORTRAIT" ,"NATURE"
public:
   void ENTER()
   {
       cin>>PCODE;gets(PTYPE);
   }
   void SHOWCASE()
   {
       cout<<PCODE<<":" <<PTYPE<<endl;
   }
   char *GETPTYPE(){return PTYPE;}
};
Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Binary File in C++ :- Creation of File, Writing Data into File, Searching for Required Data from File, Appending Data to a File, Insertion of Data in Sorted File, Deletion of Data from File, Modification of Data in a File

Find the output of the following C++ code considering that the binary file CLIENTS.DAT exists on the hard disk with a data of 200 clients:

class CLIENTS
{
    int CCode; char CName[20];
public:
    void REGISTER(); void DISPLAY();
};

void main()
{
    £stream File;
    File.open("CLIENTS.DAT", ios::binary|ios::in);
    CLIENTS C;
    File.seekg(6*sizeof(C));
    File.read((char*)&C, sizeof(C));
    cout<<"Client Number: "<<File.tellg()/sizeof(C) + 1;
    File.seekg(0 , ios :: end) ;
    cout<<"of"<<File.tellg(}/sizeof(C)<<endl;
    File.close();
}
Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Binary File in C++ :- Creation of File, Writing Data into File, Searching for Required Data from File, Appending Data to a File, Insertion of Data in Sorted File, Deletion of Data from File, Modification of Data in a File

Find the correct identifiers out of the following, which can be used for naming Variable, Constants or Functions in a C++ program.

For, while, INT, NeW, delete, lstName, Add+Subtract, namel

Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Concept of Object Oriented Programming in C++

Observe the following program very carefully and write the names of those header files (s), which are essentially needed to compile and execute the following program successfully :

typedef char STRING[80];
void main()
{
    STRING Txt[] ="We love Peace";
    int Count=O;
    while(Txt[Count]!='\0')
    if (isalpha(Txt[Count]))
       Txt[Count++]='@';
    else
       Txt[Count++]='#';
    puts(Txt);
}
Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: ifstream, ofstream, Classes

Observe the following C++ code very carefully and rewrite it after removing any/all syntactical errors with each correction underlined.

Note: Assume all required header files are already being included in the program

#Define float MaxSpeed=60.5;
void main()
{
   int MySpeed
   char Alert='N';
   cin>>MySpeed;
   if MySpeed>MaxSpeed
    Alert='Y';
    cout<<A1ert<<endline;
}

 

Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Concept of Object Oriented Programming in C++

Write the output of the following C++ program code :

Note: Assume all required header files are already being included in the program.

void Location(int &X,int Y=4)
{
   Y+=2;
   X+=Y;
}
void main()
{
   int PX=l0,PY=2;
   Location(PY);
   cout<<PX<<","<<PY<<endl;
   Location(PX,PY);
   cout<<PX<<", "<<PY<<endl;
}
Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Concept of Object Oriented Programming in C++

Write the output of the following C++ program code:

Note: Assume all required header files are already being included in the program.

class Eval
{
   char Level;
   int Point;
public:
   Eval(){Level='E'; Point=O;}
   void Sink(int L)
   {
      Level~=L;
   }
   void Float(int L)
   {
      Level+=L;
      Point++;
   }
   void Show()
   {
      cout<<Level<<"#"<<Point<<endl;
   }
};

void main ()
{
   Eval E;
   E.Sink(3);
   E.Show();
   E.Float(7);
   E.Show();
   E.Sink(2);
   E.Show();
}
Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Concept of Object Oriented Programming in C++

Study the following program and select the possible output(s) from the options (i) to (iv) following it. Also; write the maximum and the minimum values that, can be ·assigned to the variable VAL

Note:

-Assume all required header files are already being included in the program.

- random(n) function generates all integer 6, and n-1.

void main ()
{
   randomize();
   int VAL;
   VAL=random(3)+2;
   char GUESS[] ="ABCDEFGHIJK";
   for(int I = 1, I = 1;I <= VAL; I++)
   {
      for (int J=VAL; J<= 7; J++)
      cout<<GUESS[J];
      cout<<endl;
   }
}

1) 

2)

3)

4)

Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Concept of Object Oriented Programming in C++

What is a copy constructor?

Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Copy Constructor

Give a suitable example in C++ to illustrate with its definition within a class and a declaration of an object with the help of it.

Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Class and Object in C++

Observe the following C++ code and answer the questions (i) and (ii):

class Passenger
{
   long PNR;
   char Name[20];
public:
   Passenger () · //Function 1
   { cout<<"Ready"<<endl; }

   void Book(long P,char N[]) //Function 2
   { PNR = P; strcpy(Name, N);}

   void Print () //Function 3
   { cout«PNR << Name <<endl; }
   
   -Passenger() //Function 4
   { cout<<"Booking cancelled! "<<endl;}
};

1) Fill in the blank statements in Line 1 and Line 2 to execute Function 2 and Function 3 respectively in the following code:

void main()
{
   Passenger P;
   _________      //Line 1
   _________      //Line 2
}//Ends here

2) Which function will be executed at } // Ends here? What is this function referred as?

Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Member of a Class - Data Members and Member Functions (Methods)

Write the definition of a class Photo In C++ with the following description:

Private Members

- Pno    //Data member for Photo Number (an integer)

-Category //Data.member for Photo Category (a string)

- Exhibit I // Data member for Exhibition Gallery (a string) 

- FixExhibit //A member function to assign Exhibition Gallery as per Category as shown in the following table

Category Exhibit
Antique Zaveri
Modern Johnsen
Classic Terenida

Public Members

-Register()   //A function to allow user to enter values Pno I category and call FixExhibi t () function

- ViewAll()  //A function to display all the data members

Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Member of a Class - Data Members and Member Functions (Methods)

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

class Interior
{
    int Orderid;
    char Address[20];
protected:
   float Advance;
public:
   Interior();
   void Book(); void View();
};

class Painting:public Interior
{
    int Wall,Area,ColorCode;
protected:
    char Type;
public:
   Painting();
   void PBook();
   void PView();
};

class Billing : public Painting
{
   float Charges;
   void Calculate();
public:
   Billing();
   void Bill();
   void BillPrint();
};

1) Which type of Inheritance out of the following is illustrated in the above example?

  • Single Level Inheritance
  • Multi-Level Inheritance
  • Multiple Inheritance

2) Write the names of all the data members, which are directly accessible from the member functions of class Painting.

3) Write the names of all the member functions, which are directly accessible from an object of class Billing.

4) What will be the order of execution of the constructors, when an object of class Billing is declared?

Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Inheritance in C++

Write the definition of a function Change(int P[], int N) in C++, which should change all the multiples of 10 in the array to 10 and rest of the elements as 1. For example, if an array of 10 integers is as follows:

P[0] P[1] P[2] P[3] P[4] P[5] P[6] P[7] P[8] P[9]
100 43 20 56 32 91 80 40 45 21

After executing the function, the array content should be changed as follows:

P[0] P[1] P[2] P[3] P[4] P[5] P[6] P[7] P[8] P[9]
10 1 10 1 1 1 10 10 1 1

 

Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Pointers and Arrays - Array of Pointers, Pointer to an Array (1 Dimensional Array), Function Returning a Pointer, Reference Variables and Use of Alias
< prev 21 to 40 of 96 next > 
Advertisement Remove all ads
Important Questions for CBSE (Science) Class 12 CBSE Computer Science (C++). You can further filter Important Questions by subjects and topics. Chapter wise important Questions for Class 12 CBSE. it gets easy to find all Class 12 important questions with answers in a single place for students. Saving time and can then focus on their studies and practice. Important questions for Class 12 chapter wise with solutions

Class 12 Computer Science (C++) can be very challenging and complicated. But with the right ideas and support, you will be able to make it work. That’s why we have the class 12 Computer Science (C++) important questions with answers pdf ready for you. All you need is to acquire the PDF with all the content and then start preparing for the exam. It really helps and it can bring in front an amazing experience every time if you're tackling it at the highest possible level.

Computer Science (C++) exams made easy

We make sure that you have access to the important questions for Class 12 Computer Science (C++) CBSE 12th CBSE. This way you can be fully prepared for any specific question without a problem. There are a plethora of different questions that you need to prepare. And that's why we are covering the most important ones. They are the questions that will end up being more and more interesting and the results themselves can be staggering every time thanks to that. The quality itself will be quite amazing every time, and you can check the important questions for Class 12 Computer Science (C++) CBSE whenever you see fit.

The important questions for Class 12 Computer Science (C++) 2021 we provide on this page are very accurate and to the point. You will have all the information already prepared and that will make it a lot simpler to ace the exam. Plus, you get to browse through these important questions for Class 12 Computer Science (C++) 2021 CBSE 12th and really see what works, what you need to adapt or adjust and what still needs some adjustment in the long run. It's all a matter of figuring out these things and once you do that it will be a very good experience.

All you have to do is to browse the important questions for upcoming CBSE Class 12 2021 on our website. Once you do, you will know what needs to be handled, what approach works for you and what you need to do better. That will certainly be an incredible approach and the results themselves can be nothing short of staggering every time. We encourage you to browse all these amazing questions and solutions multiple times and master them. Once you do that the best way you can, you will have a much higher chance of passing the exam, and that's what really matters the most!

Advertisement Remove all ads
Share
Notifications

View all notifications


      Forgot password?
View in app×