Unit 1: Foundational Concepts - Subjective Questions

INT322 — Computing System And Technologies • Practice Questions with Detailed Answers

20 questions

1

Introduce the C and C++ programming languages. Compare their major features and programming paradigms.

2

Define data types in C/C++. Explain fundamental, derived, and user-defined data types with examples.

3

Distinguish among variables, constants, literals, and symbolic constants in C/C++. Explain their declaration and scope.

4

Explain how scanf and printf are used for formatted input and output in C. Include common format specifiers and safety considerations.

5

Describe C++ stream-based input and output using cin and cout. Compare them with scanf and printf.

6

Explain the working of if, if-else, nested if, and else-if ladders. How can logical operators be used to form compound conditions?

7

Compare for, while, and do-while loops. Explain loop control statements and common causes of infinite loops.

8

Define a function. Distinguish between function declaration, definition, and call, and explain the role of parameters and return types.

9

Compare call by value and call by reference in C++. Write functions that attempt to swap two integers using each method and explain the results.

10

Explain recursion using the factorial function. Identify the base case and recursive case, and analyze its time and auxiliary space complexity.

11

Explain the fundamental principles of object-oriented programming. Illustrate encapsulation, abstraction, inheritance, and polymorphism.

12

Distinguish between struct and class in C++. How do they differ from a C structure?

13

Design a C++ class named Rectangle to demonstrate classes, objects, data hiding, and member functions. Explain how objects of the class are used.

14

What are constructors and destructors in C++? Explain default, parameterized, and copy constructors, initialization lists, and destruction order.

15

Define a data structure. Classify data structures as primitive and non-primitive, static and dynamic, and homogeneous and non-homogeneous.

16

Compare linear and non-linear data structures. Describe the principal operations and applications of arrays, linked lists, stacks, queues, trees, and graphs.

17

Analyze the time and auxiliary space complexity of linear search and binary search. State the assumptions required for binary search.

18

Explain the time-space trade-off with suitable computing examples. Why might an algorithm intentionally use more memory?

19

Define Big-O, Big-Omega, and Big-Theta notation formally. Use them to classify .

20

Analyze the following C++ function. Determine what it computes and derive its time and auxiliary space complexity.

CPP
int countPairs(const int a[], int n) {
    int count = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            if (a[i] == a[j]) {
                ++count;
            }
        }
    }
    return count;
}