Question 1 of 5
Which of the following is a high-level programming language?
A
Assembly
B
Machine Code
C
C++
D
Binary
Why: High-level programming languages are designed to be easily readable by humans and are independent of the computer's hardware architecture. **C++** is a high-level language that abstracts low-level details like memory management through features like classes and functions. Assembly and Machine Code are low-level, while Binary is not a programming language. Thus, option C is correct.
Question 2 of 5
What is the importance of C language in programming?
Why: C is crucial for understanding computer fundamentals. It teaches memory management, pointers, and procedural programming, forming the basis for languages like C++, Java, and Python. Real-world example: Linux kernel is primarily written in C for performance.
Question 3 of 5
Consider the following C code snippet:
c\nint main() {
int x = 5;
printf("%d", x++ + ++x);
return 0;
}
What is the output of this program?
A
10
B
11
C
12
D
Undefined
Why: The expression `x++ + ++x` involves **undefined behavior** in C due to multiple modifications to `x` without a sequence point between them (pre- and post-increment in the same expression). The order of evaluation of operands is unspecified, leading to unpredictable results like 10, 11, or 12 depending on the compiler. Thus, option D is correct.
Question 4 of 5
Write a C program to find the sum of numbers from 1 to n, where n is user input.
Why: The program correctly implements the summation formula using a loop. It handles user input, performs computation, and outputs result. Key C concepts: variables, control structures, functions.
Question 5 of 5
Which type of programming paradigm does Visual Basic primarily support?
A
Procedural
B
Functional
C
Object-Oriented
D
Logic
Why: Visual Basic is primarily an **object-oriented programming (OOP)** language. It supports classes, objects, inheritance, and polymorphism through Visual Basic .NET. While earlier versions had procedural elements, modern VB emphasizes OOP. Thus, option C is correct.