See AnswerAns: #include statement is used to include library files required for various library functions. eg. iostream.h is needed for cout and cin objects and stdio.h is needed for printf() and scanf() function.
What is main()?
See AnswerAns: main() is a function from where program execution starts.
Data types available in C/C++?
See AnswerAns: int , long int, float, long float(double), long double, char, unsigned int, unsigned char.
Size and range of int and long int.
See AnswerAns: int :- Size: 4 Bytes(window based compilers), Range: -231 to 231-1.
long int: Size 8 Bytes (window based compilers), Range: -263 to 263-1.
Size and range of float and long double.
See AnswerAns: float :- Size: 4 Bytes(window based compilers), Range: 1.2-38 to 3.438.
long double: Size 10 Bytes (window based compilers), Range: 3.4-4932 to 1.14932.
Diff b/w Mod(%)and Divide(/).
See AnswerAns: Division(/) used for getting quotient value where as module(%) is used for getting remainder value.
What will be the output of:
int x=5/2;
See AnswerAns: 2
float x=5/2;
See AnswerAns: 2.000000
float 5.0/2;
See AnswerAns: 2.500000
What will be the output of:
int x=8.0%3;
See AnswerAns: Error: Mod never works with float.
What will be the output of:
float discount=10/100*8000.0;
See AnswerAns: 0. because 10/100 generates 0. (int/int = int).
What is hierarchy/precedence of arithmetic operators in C/C++.
See AnswerAns: Order of execution of arithmetic operators in an expression is known as hierarchy.
What is a Variable?
See AnswerAns: A storage location in memory.
What is Token?
See AnswerAns: A token is the smallest element of a program that is meaningful to the compiler. Tokens can be classified as follows:
1. Keywords 2. Identifiers 3. Constants 4. Strings 5. Special Symbols 6. Operators
What will be the output of:
int x=-5%2;
See AnswerAns: -1 (The sign of numerator will be the sign of result).
int y=5%-2;
See AnswerAns: 1 (The sign of numerator will be the sign of result).
int z=-5%-2;
See AnswerAns: -1 (The sign of numerator will be the sign of result).
What is Explicit type casting?
See AnswerAns: In computer science, type conversion or typecasting refers to changing an entity of one datatype into another. There are two types of conversion: implicit and explicit. The term for implicit type conversion is coercion. Explicit type conversion in some specific way is known as casting.
What is Printf()and Scanf()?
See AnswerAns: printf() and scanf() are functions.
Does Printf() return any Value?
See AnswerAns: yes printf() return int value. It return no. of characters printed on screen.
eg. int x=printf("BCE");
printf("%d",x); //3