Computer Science Paper-II (2nd Year) –
Solved
SECTION B (Short Answer Questions)
Attempt any 10 questions.
1. 1. What is IDE?
An IDE (Integrated Development Environment) is software combining developer tools in
one GUI. Example: Turbo C, Dev-C++. Shortcut to run: Ctrl + F9.
2. 2. What are escape sequences?
Special characters like \n (newline), \t (tab), used for formatting output.
3. 3. Expressions in C
a) (a + b)/(ab): (a + b) / (a * b);
b) Y = (a + b)²: Y = (a + b) * (a + b);
4. 4. Valid/Invalid Identifiers
Valid: num1, _value, totalSum. Invalid: 1stValue, float, a+b
5. 5. Increment/Decrement Operators
++ (increment), -- (decrement). Example: x++; x--;
6. 6. Output of Code
int x=1; printf("%d %d %d", x, ++x, x++); → Undefined output (compiler dependent).
7. 7. What is an Array?
A collection of similar data types. Example: int arr[5];
8. 8. Output of int num[5] = {3,5,7,10,6}; printf("%d", num[2]);
Output: 7
9. 9. Break/Continue
break exits loop; continue skips to next iteration.
10. 10. While vs Do-While
while checks condition first, do-while executes once before checking.
11. 11. Pointer
Stores address of another variable. Example: int *p = &x;
12. 12. Compiler in C
Converts source code to machine code.
13. 13. High-Level Language
Closer to human language. Example: C, Python.
14. 14. Source vs Object Code
Source: programmer-written code. Object: machine-generated code.
15. 15. Address Operator
& gives address. Example: &x;
16. 16. Syntax of C Program
#include <stdio.h>
int main() { printf("Hello"); return 0; }
SECTION C (Detailed Answer Questions)
Attempt any 3 questions.
17. 1. Control Structures in C
Sequential, Conditional (if, switch), Iterative (for, while, do-while).
Example:
for (int i = 0; i < 5; i++) { printf("%d", i); }
18. 2. Data Types
int, float, char, double, void.
19. 3. Operators
Arithmetic (+, -, *, /), Relational (==, !=), Logical (&&, ||).
20. 4. I/O Functions
printf() for output, scanf() for input.
Example: scanf("%d", &x);
21. 5. Functions
Reusable blocks. Types: with/without arguments/return. Example:
int sum(int a, int b) { return a + b; }