Programming Fundamentals Question Bank
Showing 48 questions of 48 with verified answers
(Conceptual) In the software build process, which stage is responsible for combining multiple object files and libraries into a single executable file?
(Comparison) A language that requires you to declare int x = 5; and throws an error if you try to assign x = "Hello"; later is best described as:
(Scenario-Based) A developer is writing a high-performance graphics engine where every millisecond of CPU time matters. Which type of language should they prioritize?
(Code-Tracing / Logic) In a Weakly Typed language like JavaScript, what is the likely result of the expression: "5" + 2?
(Conceptual) Which programming paradigm is built around the concept of "Pure Functions" that do not have side effects or shared state?
(Debugging) During compilation, the compiler finds a line of code: if (x == 5) { y = 10 } but notices the closing ) is missing. Which phase of the compiler detects this?
(Comparison) What is the primary advantage of a Managed Language (like Java or C# with a Virtual Machine/CLR) over an Unmanaged Language (like C++)?
(Scenario-Based) You are creating a small script to automate a file-renaming task that will only be run once. You want to write it quickly without a "Build/Compile" step. Which type of language is best?
(Conceptual) What is the role of a "Virtual Machine" (like the JVM) in the execution of a program?
(Code Output / Logic) Trace the logic in this pseudocode: x = "100" y = 50 print(x + y) If the language is Strongly Typed (like Python), what happens?
(Conceptual) In the context of programming paradigms, "Encapsulation" is a core principle of which paradigm?
(Scenario-Based) A developer is writing code for a microcontroller with very limited RAM (only 2KB). Which language feature should they avoid to prevent crashing?
(Comparison) What is a Transpiler (Source-to-Source Compiler)?
(Conceptual) What is "Semantic Analysis" in the compilation process?
(Scenario-Based) You are using a language that uses a Just-In-Time (JIT) compiler. When does the actual machine code generation happen?
(Conceptual) In memory management, where are Primitive variables usually stored compared to Reference objects? • • • •
(Code-Tracing) What is the output of the following C++/Java code? double myValue = 9.99; int result = (int) myValue; print(result);
(Scenario-Based) You are designing a system to store the population of the world (approx. 8 billion). Which data type is the most appropriate to prevent overflow?
(Debugging) A developer writes: float price = 19.99; in Java/C#. The compiler throws an error: "Incompatible types: possible lossy conversion from double to float." Why?
(Conceptual) What is the effect of the static keyword on a variable declared inside a class?
(Code-Tracing) Trace this logic: int a = 127; byte b = (byte) a; b++; print(b); Assuming a standard 8-bit signed byte (-128 to 127):
(Scenario-Based) An application needs to represent four specific states of an order: PENDING, SHIPPED, DELIVERED, CANCELLED. What is the most type-safe way to represent this?
(Comparison) What is the difference between NULL (C++) and null (Java/C#)?
(Conceptual) Why are String objects "Immutable" in languages like Java and Python?
(Code-Tracing) What is the output of this code? char c = 'A'; print(c + 1); Assuming 'A' has an ASCII value of 65:
(Scenario-Based) You are calculating the interest on a bank account with 10 million users. Using float for the balance results in a discrepancy of $50,000 across the whole system. What is the cause?
(Conceptual) What is a "Wrapper Class" in Java (e.g., Integer for int)?
(Comparison) What is the difference between const and readonly in C#?
(Code-Tracing) What is the value of result? int x = 10; float y = 4.0f; auto result = x / y; (Using C++/Java logic where auto or var infers the type)
(Conceptual) Which of the following is an example of an "Unsigned" data type violation?
(Code-Tracing) What is the final value of z? • • • • int x = 5; int y = 2; int z = x / y * y;
(Code-Tracing) Trace the value of x and y: int x = 10; int y = x++;
(Scenario-Based) Which operator is best used to check if a specific number N is a multiple of 10?
(Debugging) Trace the following logic: int count = 0; if (true || (++count > 0)) { print(count); }
(Calculation) What is the result of the bitwise XOR (^) operation on 5 and 3?
(Code-Tracing) What will be printed? int x = 10; int y = 20; print(x > 5 && y < 15 ? "Alpha" : "Beta");
(Conceptual) What does performing a Bitwise Left Shift (<<) by 2 positions do to an integer?
(Code-Tracing) Trace the value of val: int val = 8; val >>= 2;
(Comparison) What is the difference between & and && in Java/C#?
(Calculation) Evaluate the expression: 10 + 5 * 2 == 20
(Scenario-Based) A developer needs to swap two integers a and b without using a third temporary variable. Which bitwise operator can achieve this?
(Debugging) Trace this code snippet: int x = 5; if (x = 0) { print("Zero"); } else { print("Non-Zero"); } In C/C++, what is the output?
(Code-Tracing) Trace the output: int i = 5; int j = ++i + i++; print(j);
(Conceptual) Which operator has the lowest precedence in most programming languages?
(Code-Tracing) Trace the value of ans: int ans = 10 % 3 + 4 << 1;
(Code-Tracing) What is the output of the following C++/Java code? • • • • int x = 2; switch (x) { case 1: print("A"); case 2: print("B"); case 3: print("C"); default: print("D"); }
(Debugging) A developer wants a loop that runs exactly 10 times. Which of the following contains a logical error?
(Code-Tracing) How many times will "Hello" be printed? for (int i = 0; i < 3; i++) { for (int j = 0; j < 2; j++) { if (i == j) continue; print("Hello"); } }