You are on page 1of 2

BS-CS 1st Term Examination 2016

Objective Part

Answers:

1. Ans.
50 / ( 6 + ( 8 – 4 ) * 2 ) + 15
50 / ( 6 + 4 * 2 ) + 15
50 / ( 6 + 8 ) + 15
50 / 14 + 15
3.57 + 15
18.57
2. Ans.
\b: This escape sequence is used to insert backspace in the output. For example:
printf(“Hello\bWorld”); will display
HellWorld
\n: This escape sequence is used to insert new line in output. For example:
printf(“Hello\nWorld”); will display
Hello
World
3. Ans.
Implicit Type Casting: Pg# 68 (C++)
Explicit Type Casting: Pg# 69 (C++)
4. Ans.
The given statement is invalid as according to rule of identifier the first character should must
be the alphabet or underscore (_). It can be written as:
int _2abc = 6; OR
int abc2 = 6;
5. Ans.
The output of the code is
1
_
6. Ans.
Scope: Function chapter # 9
Life Time: Function chapter #9
7. Ans.
In while loop, condition comes before the body of the loop. In do-while loop, condition comes
after the body of the loop. If condition is false in the beginning, while loop is never executed.
do-while is executed at least once even if the condition is false in the beginning.
8. Ans.
*ptr = &(i + j);
9. Ans.
30
10. Ans.
int arr[5] = {1,2,3,4,5}; OR
int arr[ ] = {1,2,3,4,5};
11. Ans.
int a, *ptr;
12. Ans.
double reference (int);

You might also like