Download CBSE Class 12 Computer Science Introduction To C++ Notes in PDF format. All Revision notes for Class 12 Computer Science have been designed as per the latest syllabus and updated chapters given in your textbook for Computer Science in Class 12. Our teachers have designed these concept notes for the benefit of Class 12 students. You should use these chapter wise notes for revision on daily basis. These study notes can also be used for learning each chapter and its important and difficult topics or revision just before your exams to help you get better scores in upcoming examinations, You can also use Printable notes for Class 12 Computer Science for faster revision of difficult topics and get higher rank. After reading these notes also refer to MCQ questions for Class 12 Computer Science given on studiestoday
Revision Notes for Class 12 Computer Science Introduction To C++
Class 12 Computer Science students should refer to the following concepts and notes for Introduction To C++ in Class 12. These exam notes for Class 12 Computer Science will be very useful for upcoming class tests and examinations and help you to score good marks
Introduction To C++ Notes Class 12 Computer Science
Structure-Collection of logically related different data types (Primitive and Derived) referenced under one name.
Nested structure
• A Structure definition within another structure.
• A structure containing object of another structure.
typedef
• Used to define new data type name
#define Directives
• Use to define a constant number or macro or to replace an instruction.
Inline Function
• Inline functions are functions where the call is made to inline functions, the actual code then gets placed in the calling program.
• What happens when an inline function is written?
• The inline function takes the format as a normal function but when it is compiled it is compiled as inline code. The function is placed separately as inline function, thus adding readability to the source program. When the program is compiled, the code present in function body is replaced in the place of function call.
General Format of inline Function:
The general format of inline function is as follows:
inline datatype function_name(arguments)
inline int MyClass( )
Example:
#include <iostream.h>
int MyClass(int);
void main( )
{int x;
cout << “\n Enter the Input Value: ”;
cin>>x;
cout<<”\n The Output is: “ << MyClass(
} inline int MyClass(int x1)
{return 5*x1;}
The output of the above program is:
Enter the Input Value: 10
The Output is: 50
The output would be the same even when the inline function is written solely as a function. The concept, however, is different. When the program is compiled, the code present in the inline function MyClass ( ) is replaced in the place of function call in the calling program. The concept of inline function is used in this example because the function is a small line of code.
The above example, when compiled, would have the structure as follows:
#include <iostream.h>
int MyClass(int);
void main( )
{int x;
cout << “\n Enter the Input Value: ”; cin>>x;
//The MyClass(x) gets replaced with code return 5*x1;
cout<<”\n The Output is: “ << MyClass(x);
}
#include <iostream.h>
int MyClass(int);
void main( )
{int x;
cout << “\n Enter the Input Value: ”;
cin>>x;
//Call is made to the function MyClass
cout<<”\n The Output is: “ << MyClass(x);
}
int MyClass(int x1)
{return 5*x1;}
1 Marks questions
1) Name the header files that shall be needed for the following code:
void main( )
{ char word[]=”Board Exam”;
cout<<setw(20)<<word;
}
2) Name the Header file to which the following built in functions belongs to:
(i) gets() (ii) abs() (iii) sqrt() (iv) open()
2 Marks questions:
1) Rewrite the following program after removing the syntactical error(s) if any. Underline each correction.
#include<iostream.h>
void main( )
{ F = 10, S = 20;
test(F;S);
test(S);
}
void test(int x, int y = 20)
{ x=x+y;
count<<x>>y;
}
2) Find the output of the following program:
#include<iostream.h>
void main( )
{ int U=10,V=20;
for(int I=1;I<=2;I++)
{ cout<<”[1]”<<U++<<”&”<<V 5 <<endl;
cout<<”[2]”<<++V<<”&”<<U + 2 <<endl; } }
3) Rewrite the following C++ program after removing the syntax error(s) if any. Underline each correction. [CBSE 2010]
include<iostream.h>
class FLIGHT
{ Long FlightCode;
Char Description[25];
public
void addInfo()
{ cin>>FlightCode; gets(Description);}
void showInfo()
{ cout<<FlightCode<<”:”<<Description<<endl;}
};
void main( )
{ FLIGHT F;
addInfo.F();
showInfo.F;
}
4) In the following program, find the correct possible output(s)from the options:
#include<stdlib.h>
#include<iostream.h>
void main( )
{ randomize( );
char City[ ][10]={“DEL”, “CHN”, “KOL”, “BOM”, “BNG”};
int Fly;
for(int I=0; I<3;I++)
{Fly=random(2) + 1;
cout<<City[Fly]<< “:”;
}}
Outputs:
(i) DEL : CHN : KOL: (ii) CHN: KOL : CHN:
(iii) KOL : BOM : BNG: (iv) KOL : CHN : KOL:
5) In the following C++ program what is the expected value of Myscore from options (i) to (iv) given below. Justify your answer.
#include<stdlib.h>
#include<iostream.h>
void main( )
{ randomize( );
int Score[ ] = {25,20,34,56,72,63},Myscore;
cout<<Myscore<<endl;
}I
i) 25 (ii) 34 (iii) 20 (iv) Garbage Value.
Answer to Questions
1 Marks Answer
1) Ans: iostream.h
iomanip.h
2) Ans: iostream.h (ii) math.h,stdlib.h (iii) math.h (iv)fstream.h
2 marks Answers
1 Ans:
#include<iostream.h>
void test(int x,int y=20); //Prototype missing
void main( )
{ int F = 10, S = 20; //Data type missing
Text(F,S); //Comma to come instead of ;
Text(S);
void Text(int x, int y)
{ x=x+y;
cout<<x<<y; //Output operator << required }
2 Ans:Output:
[1]10&15
[2]21&13
[1]11&16
[2]22&14
3 Ans: #include<iostream.h>
class FLIGHT
{ long FlightCode;
char Description[25];
public:
void addInfo()
{ cin>>FlightCode; gets(Description);}
void showInfo()
{ cout<<FlightCode<<”:”<<Description<<endl;}
};
void main( )
{ FLIGHT F;
F.addInfo();
F.showInfo;
}
4 Ans)
Since random(2) gives either 0 or 1, Fly value will be either 1 or 2.
Please click the link below to download pdf file for CBSE Class 12 Computer Science - Introduction to C++.
CBSE Class 11 Computer Science Computing and Binary Operation Notes |
CBSE Class 12 Computer Science Introduction To C++ Notes
We hope you liked the above notes for topic Introduction To C++ which has been designed as per the latest syllabus for Class 12 Computer Science released by CBSE. Students of Class 12 should download and practice the above notes for Class 12 Computer Science regularly. All revision notes have been designed for Computer Science by referring to the most important topics which the students should learn to get better marks in examinations. Our team of expert teachers have referred to the NCERT book for Class 12 Computer Science to design the Computer Science Class 12 notes. After reading the notes which have been developed as per the latest books also refer to the NCERT solutions for Class 12 Computer Science provided by our teachers. We have also provided a lot of MCQ questions for Class 12 Computer Science in the notes so that you can learn the concepts and also solve questions relating to the topics. We have also provided a lot of Worksheets for Class 12 Computer Science which you can use to further make yourself stronger in Computer Science.
You can download notes for Class 12 Computer Science Introduction To C++ for latest academic session from StudiesToday.com
Yes, the notes issued for Class 12 Computer Science Introduction To C++ have been made available here for latest CBSE session
There is no charge for the notes for CBSE Class 12 Computer Science Introduction To C++, you can download everything free of charge
www.studiestoday.com is the best website from which you can download latest notes for Introduction To C++ Computer Science Class 12
Come to StudiesToday.com to get best quality topic wise notes for Class 12 Computer Science Introduction To C++