हिंदी

Science (English Medium) कक्षा १२ - CBSE Important Questions

Advertisements
[object Object]
[object Object]
विषयों
मुख्य विषय
अध्याय

Please select a subject first

Advertisements
Advertisements
< prev  3441 to 3460 of 6295  next > 

Anil typed the following C++ code and during compilation, he found three errors as follows :

1) Function strlen should have a prototype

2) Undefined symbol cout

3) Undefined symbol endl

On asking, his teacher told him to include necessary header files in the code. Write the names of the header files, which Anil needs to include, for successful compilation and execution of the following code:

void main()
{
    char Txt[] = "Welcome";
    for(int C= 0; C<strlen(Txt); C++)
       Txt[C] = Txt[C]+ 1;
    cout<<Txt<<endl;
}
Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Header File - fstream.h

Rewrite the following C++ code after removing any/all syntactical errors with each correction underlined.

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

void main()
{
     cout<<"Enter an Alphabet:" ;
     cin>>CB ;
     switch(CH)
     case 'A' · cout<<"Ant"; Break ;
     case 'B' · cout<<"Bear"; Break;
}
Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Concept of Object Oriented Programming in C++

Find and write the output of the. following C++ program code

Note : Assume au· required header files are already included in the program.

#define Diff(N1,N2) ((N1>N2)?Nl-N2:N2-N1)
void main()
{
    int A,B,NUM[] = {10,23,14,54,32};
    for(int CNT =4; CNT > 0; CNT--)
    {
        A=NUM[CNT];
        B=NUM[CNT-1];
        cout<<Diff(A,B)<< '#';
    }
}
Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Advantages of Object Oriented Programming Over Earlier Programming Methodologies in C++

Find and write the output of the following C++ program code :
Note : Assume all required header files are already being included in the program.

void main()
{
     int *Point, Score[]={100,95,150 , 75 , 65, 120};
     Point = Score;
     for(int L = 0; L<6; L++)
     {
         if((*Poi nt)%10==0)
            *Point /= 2;
         else
            *Point -= 2;
         if((*Point) %5==0)
            *Point /= 5;
         Point++;
      }
      for(int L = 5; L>=O; L--)
          cout<<Score[L]<<"*";
}
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

Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it. Also, write the maximum values that can be assigned to each of the variables N and M

Note:

  • Assume all the .required header files are already being included in the code.
  • The function random(n) generates an integer between 0 and n-1
void main()
{
    randomize() ;
    int N=random(3), M=random(4);
    int DOCK[3][3] = {{1,2,3},{2,3,4}, {3,4,5}};
    for(int R=O; R<N; R++)
   {
       for(int C = 0; C< M; C++)
·        cout<<DOCK[R][C]<<" ";
       cout<<endl;
    }
}
1)
2)
3)
4)
Appears in 1 question paper
Chapter: [6] Object Oriented Programming in C++
Concept: Member of a Class - Data Members and Member Functions (Methods)

Differentiate between protected .and private me~bers of a class. in context of Object Oriented Programming. Also, give a suitable example illustrating accessibility/non-accessibility of each using a class and an object in C++.

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

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

Note: Assume all necessary files are included

class TEST
{
    long TCode ;
    char TTitle[20];
    float Score;
public:
    TEST()      //Member Function 1
    {
         TCode=100;strcpy(TTit1e,"FIRST Test"); Score=O;
    };
    TEST(TEST &T)    //Member Function 2
    {
         TCode=E.TCode+1;
         strcpy(TTitle , T.TTitle);
         Score=T.Score;
     }
};

void main()
{
   __________    //Statement 1
   __________    //Statement 2
}

1) Which Object-Oriented Programming feature is illustrated by the Member Function 1 and the Member Function 2 together in the class TEST?

2) Write Statement 1 and Statement 2 to execute Member Function 1 and Member Function 2 respectively.

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 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

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
< prev  3441 to 3460 of 6295  next > 
Advertisements
Advertisements
CBSE Science (English Medium) कक्षा १२ Important Questions
Important Questions for CBSE Science (English Medium) कक्षा १२ Biology
Important Questions for CBSE Science (English Medium) कक्षा १२ Chemistry
Important Questions for CBSE Science (English Medium) कक्षा १२ Computer Science (C++)
Important Questions for CBSE Science (English Medium) कक्षा १२ Computer Science (Python)
Important Questions for CBSE Science (English Medium) कक्षा १२ English Core
Important Questions for CBSE Science (English Medium) कक्षा १२ English Elective - NCERT
Important Questions for CBSE Science (English Medium) कक्षा १२ Entrepreneurship
Important Questions for CBSE Science (English Medium) कक्षा १२ Geography
Important Questions for CBSE Science (English Medium) कक्षा १२ Hindi (Core)
Important Questions for CBSE Science (English Medium) कक्षा १२ Hindi (Elective)
Important Questions for CBSE Science (English Medium) कक्षा १२ History
Important Questions for CBSE Science (English Medium) कक्षा १२ Informatics Practices
Important Questions for CBSE Science (English Medium) कक्षा १२ Mathematics
Important Questions for CBSE Science (English Medium) कक्षा १२ Physical Education
Important Questions for CBSE Science (English Medium) कक्षा १२ Physics
Important Questions for CBSE Science (English Medium) कक्षा १२ Political Science
Important Questions for CBSE Science (English Medium) कक्षा १२ Psychology
Important Questions for CBSE Science (English Medium) कक्षा १२ Sociology
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×