Computer Science With C++ Chapter 1 C++ Revision Tour
  • Sponsor Area

    NCERT Solution For Class 12 Computer And Communication Technology Computer Science With C++

    C++ Revision Tour Here is the CBSE Computer And Communication Technology Chapter 1 for Class 12 students. Summary and detailed explanation of the lesson, including the definitions of difficult words. All of the exercises and questions and answers from the lesson's back end have been completed. NCERT Solutions for Class 12 Computer And Communication Technology C++ Revision Tour Chapter 1 NCERT Solutions for Class 12 Computer And Communication Technology C++ Revision Tour Chapter 1 The following is a summary in Hindi and English for the academic year 2021-2022. You can save these solutions to your computer or use the Class 12 Computer And Communication Technology.

    Question 1
    CBSEENCO12011513

    Write the type of C++ tokens (keywords and user-defined identifiers) from the following :

    (i) For
    (ii) delete
    (iii) default
    (iv) Value

    Solution

    (i) For - user defined identifier
    (ii) delete - keyword
    (iii) default - keyword
    (iv) Value - user defined identifier

    Question 3
    CBSEENCO12011515

    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 integer”;
          cin>>N;
          switch(N%2)
          case 0 cout<<'Even'; Break;
          case 1 cout<<'Odd'; Break;
    }

    Solution
    void main()
    {
          int N;
          cout<<'Enter an integer';
          cin>>N;
          switch(N%2)
    {
         case 0 :
         cout<<'Even'; break;
         case 1 :
         cout<<'Odd' ; break;
    }

    Each correction is bold and underlined.

    Question 10
    CBSEENCO12011560

    Write the type of C++ tokens (keywords and user defined identifiers) from the following:
    (i) new
    (ii) While
    (iii) case
    (iv) Num_2

    Solution

    Types of C++ tokens:
    (i) new - Keyword
    (ii) While - User defined Identifier
    (iii) case - Keyword
    (iv) Num_2 - User defined Identifier

    Question 12
    CBSEENCO12011562

    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>>CH;
    	switch(CH)
    	case 'A' cout<<'Ant'; Break;
    	case 'B' cout<<'Bear' ; Break;
    }

    Solution
    void main()
    {
       cout<<'Enter an Alphabet:';
       char CH;               
       cin>>CH;
       switch(CH)
     {                    
       case ‘A’ :        
       cout<<'Ant'; break
       case ‘B’ :        
       cout<<'Bear'; break
     }
    }

    Sponsor Area

    Question 19
    CBSEENCO12011607

    Out of the following, find those identifiers, which cannot be used for naming Variable, Constants or Functions in a C++ program:

    _Cost, Price*Qty, float, Switch,
    Address One, Delete, Number12, do

    Solution

    Price*Qty, Address One, do and float is cannot be used for naming variable, constants or Functions in a C++ program.

    Question 25
    CBSEENCO12011659

    Find the correct identifiers out of the following, which can be used for naming variables, constants or functions in a C++ program:

    While, for, Float, new, 2ndName, A%B, Amount2, _Counter

    Solution

    Identifiers which can be used for naming variables constants in a C++ program are given below:

    While, Float, Amount2, _Counter

    Question 33
    CBSEENCO12011710

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

    Solution
    Type Casting Automatic Type Conversion
    Type Casting is used to convert the value of one type to another type. Automatic Type Conversion is the type conversion done by the compiler wherever required.
    For example,
    float x = (float)3/2;
    //1.5 will be assigned as result, because 3 is converted into 3.0
    For example,
    float x = 3/2;
    // here 1.0 will be assigned as result, because 1 is automatically converted in 1.0
    Question 35
    CBSEENCO12011712

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

    Solution
    #include<iostream.h>
    #include<iomanip.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;
    I.Purchase();
    I.Sale();
    I.Sale(0);
    }

    Mock Test Series

    Sponsor Area

    Sponsor Area

    NCERT Book Store

    NCERT Sample Papers

    Entrance Exams Preparation

    19