We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1
1
Computer Science XII (Notes 2024 – By Faheed Masood Hashmi(IMCB Mughal)
Chapter No. 3: OBJECT ORIENTED PROGRAMMING IN C++ Q1. Define a header file. Ans. Header File: A header file contains C language definitions and structures. It is declared at the top of a program with extension .h (dot h) using #include directive. Examples of Header Files: iostream.h, conio.h, stdio.h, math.h etc. Q2. What is meant by preprocessor directive in C++? Ans. Preprocessor Directive: A preprocessor directive is a statement which starts with #(hashtag symbol) at the beginning of a program. It is an instruction for the compiler before the compilation starts. Examples of Preprocessor Directive in C++: #include, #define, #undef etc.
Q3. What are reserved words in C++?
Ans. Reserved Words: Reserved words are special words which have been reserved by C language for a predefined/specific purpose. There are about 80 reserved words in C++. Examples of Reserved Words in C/C++: int, for, if, while, do etc. Q4. What is a statement terminator in C/C++? Ans. Statement Terminator (Semicolon): A semicolon (;) appears at the end of each C/C++ language statement. This is also known as a statement terminator. Q5. Explain Comments in C++. Also describe types of comments used in C/C++. Ans. Comments: Comments are used to explain statements of the source code. Comments are not executed by the compiler. Comments make the program source code readable. There are two types of comments in C/C++:- Types of Comments inC/C++: There are two types of comments in C/C++:- 1. Single Line Comments: Single line comments start with // (double forward slash) and continue only in the same line. Example of Single Line Comment: #include<iostream> using namespace std; int main(void) { cout<<"IMCB Mughal"; //ye output k liay hay. return(0); } 2. Multiple Lines Comments (/*and*/): Multiple line comments can cover multiple lines. A multiple line comment starts with /* and ends with */. Example of Multiple Line Comment: #include<iostream> using namespace std; int main(void) { cout<<"IMCB Mughal"; /*ye output k liay hay. This above statement is for showing the output on screen*/ return(0); }