HomeSubjectsUniversityBlogAbout

Programming Fundamentals

Topic in Programming

210 total MCQsShowing 30 with explanations10 Easy10 Medium10 Hard

About This Topic

Programming fundamentals are the core ideas behind writing instructions a computer can execute, from source code and syntax to how that code is run. Questions ask how compilers, interpreters, assemblers and linkers differ, what bytecode is, and how a program moves through lexical analysis, parsing and code generation. You should classify syntax, runtime and logic errors, define keywords and identifiers, and compare static with dynamic typing. Harder items reach into compiler theory, such as multi-pass compilation, LL versus LR parsers and bootstrapping, as well as evaluation strategies like call-by-name versus call-by-need and the undecidable halting problem.

Below are 30 practice questions from a pool of 210 Programming Fundamentals MCQs, one of 16 topics in Programming. Each shows the correct answer with an explanation; when you are ready, take a timed quiz to test recall under exam conditions.

Practice Questions

Each question below shows the correct answer with a full explanation. Use these to build conceptual understanding before attempting a timed quiz.

Programming FundamentalsEasy

Q1. What is a computer program?

  1. A.A set of instructions for a computer to execute✓ Correct
  2. B.A system that manages hardware resources
  3. C.A physical component inside the computer case
  4. D.A protocol for transmitting network data

Explanation

A computer program is a set of instructions that tells the computer what to do.

Report an error in this question

Programming FundamentalsEasy

Q2. Which of the following is a low-level programming language?

  1. A.JavaScript
  2. B.Kotlin
  3. C.Assembly✓ Correct
  4. D.Python

Explanation

Assembly language is a low-level language that closely corresponds to machine code.

Report an error in this question

Programming FundamentalsEasy

Q3. What does a compiler do?

  1. A.Allocates and manages runtime memory
  2. B.Converts entire source code to machine code✓ Correct
  3. C.Identifies and removes bugs from programs
  4. D.Executes source code one line at a time

Explanation

A compiler translates the entire source code into machine code before execution.

Report an error in this question

Programming FundamentalsEasy

Q4. Which is NOT a programming paradigm?

  1. A.Procedural Programming
  2. B.Functional Programming
  3. C.Structural Networking✓ Correct
  4. D.Object-Oriented Programming

Explanation

Structural Networking is not a recognized programming paradigm.

Report an error in this question

Programming FundamentalsEasy

Q5. What is the purpose of pseudocode?

  1. A.To plan program logic in plain language✓ Correct
  2. B.To write actual machine-executable code
  3. C.To compile a program into bytecode
  4. D.To debug errors in existing code

Explanation

Pseudocode is used to plan program logic in human-readable form before actual coding.

Report an error in this question

Programming FundamentalsEasy

Q6. What is a syntax error?

  1. A.A failure in the underlying hardware
  2. B.A violation of the language grammar rules✓ Correct
  3. C.A mistake in the program logic flow
  4. D.A crash that occurs during runtime only

Explanation

A syntax error occurs when code violates the grammatical rules of the programming language.

Report an error in this question

Programming FundamentalsEasy

Q7. What is the difference between a compiler and an interpreter?

  1. A.An interpreter generates standalone machine code files for later execution
  2. B.They are functionally identical with no meaningful differences at all
  3. C.A compiler translates all code at once; an interpreter translates line by line✓ Correct
  4. D.A compiler always executes faster than an interpreter in every case

Explanation

A compiler processes the entire source code before execution, while an interpreter processes it line by line.

Report an error in this question

Programming FundamentalsEasy

Q8. What is an algorithm?

  1. A.A step-by-step problem-solving procedure✓ Correct
  2. B.A high-level programming language
  3. C.A standalone software application
  4. D.A structured data storage format

Explanation

An algorithm is a finite sequence of well-defined steps to solve a specific problem.

Report an error in this question

Programming FundamentalsEasy

Q9. Which of the following is a high-level language?

  1. A.Python✓ Correct
  2. B.Assembly
  3. C.FORTRAN
  4. D.Haskell

Explanation

Python is a high-level language that abstracts away hardware details.

Report an error in this question

Programming FundamentalsEasy

Q10. What does IDE stand for?

  1. A.Integrated Development Environment✓ Correct
  2. B.Internal Data Engine
  3. C.Indexed Database Engine
  4. D.Internet Development Extension

Explanation

IDE stands for Integrated Development Environment, a software tool for writing and testing code.

Report an error in this question

Programming FundamentalsMedium

Q11. What is the difference between compilation and interpretation in terms of error detection?

  1. A.Compilation detects syntax errors before execution; interpretation at runtime✓ Correct
  2. B.Interpretation detects every error before execution even begins
  3. C.There is no practical difference between the two in error detection
  4. D.Compilation detects all errors only at runtime during execution

Explanation

Compilers check syntax of the entire program before execution, while interpreters find errors as each line is executed.

Report an error in this question

Programming FundamentalsMedium

Q12. Which generation of programming languages includes languages like C and Java?

  1. A.First generation
  2. B.Second generation
  3. C.Fifth generation
  4. D.Third generation✓ Correct

Explanation

C and Java are third-generation languages (3GL) which use human-readable syntax.

Report an error in this question

Programming FundamentalsMedium

Q13. What is Just-In-Time (JIT) compilation?

  1. A.Compiling code during execution for performance✓ Correct
  2. B.Handling runtime errors through catch blocks
  3. C.Compiling all code before shipping to users
  4. D.Writing source code at the very last minute

Explanation

JIT compilation converts bytecode to machine code during runtime for improved performance.

Report an error in this question

Programming FundamentalsMedium

Q14. What is the role of a linker in program compilation?

  1. A.It combines object files into an executable✓ Correct
  2. B.It interprets bytecode during execution
  3. C.It validates syntax in the source code
  4. D.It manages runtime memory allocation

Explanation

A linker combines multiple object files and resolves references to produce a final executable.

Report an error in this question

Programming FundamentalsMedium

Q15. What is the difference between strongly typed and weakly typed languages?

  1. A.There is no real difference between the two type systems
  2. B.Strongly typed languages allow implicit type conversions freely
  3. C.Strongly typed enforces strict rules and restricts conversions✓ Correct
  4. D.Weakly typed languages enforce very strict type conversion rules

Explanation

Strongly typed languages enforce strict type checking and restrict implicit type conversions.

Report an error in this question

Programming FundamentalsMedium

Q16. What is bytecode?

  1. A.Source code that is written using bytes
  2. B.Encrypted form of the original source
  3. C.Intermediate code run on a virtual machine✓ Correct
  4. D.Binary code identical to machine code

Explanation

Bytecode is an intermediate representation that is executed by a virtual machine like the JVM.

Report an error in this question

Programming FundamentalsMedium

Q17. What is the purpose of a preprocessor in C/C++?

  1. A.To optimize generated machine code output
  2. B.To process directives like #include and #define✓ Correct
  3. C.To execute the compiled program directly
  4. D.To link external libraries to the binary

Explanation

The preprocessor handles directives such as #include and #define before the compiler processes the code.

Report an error in this question

Programming FundamentalsMedium

Q18. Which of the following best describes a runtime error?

  1. A.An error detected during the compilation phase
  2. B.An error that occurs while the program executes✓ Correct
  3. C.A syntax mistake caught before program runs
  4. D.A warning generated by the development IDE

Explanation

A runtime error occurs during program execution, such as division by zero or null pointer access.

Report an error in this question

Programming FundamentalsMedium

Q19. What is type inference?

  1. A.A runtime error caused by wrong type assignment
  2. B.The compiler automatically determining variable type✓ Correct
  3. C.A debugging technique to inspect type values
  4. D.Manually specifying every variable data type

Explanation

Type inference allows the compiler to deduce the data type of a variable from its assigned value.

Report an error in this question

Programming FundamentalsMedium

Q20. What is the call stack used for in program execution?

  1. A.Tracking function calls and local variables✓ Correct
  2. B.Handling incoming network data requests
  3. C.Storing all global variables and constants
  4. D.Managing all file input/output operations

Explanation

The call stack keeps track of active function calls and stores local variables and return addresses.

Report an error in this question

Programming FundamentalsHard

Q21. What is the halting problem in computer science?

  1. A.Optimizing a program execution speed through advanced compiler techniques
  2. B.Determining whether an arbitrary program will finish running or loop forever✓ Correct
  3. C.Finding and reporting memory leaks occurring during a program execution
  4. D.Determining whether a program contains syntax errors in its source code

Explanation

The halting problem, proven undecidable by Turing, asks whether a program will terminate or run forever for a given input.

Report an error in this question

Programming FundamentalsHard

Q22. In language theory, what is a context-free grammar (CFG)?

  1. A.A grammar where production rules apply regardless of context✓ Correct
  2. B.A grammar equivalent to standard regular expressions
  3. C.A grammar where rules depend on surrounding token context
  4. D.A grammar that is exclusively used in natural languages

Explanation

A CFG has production rules where the left side is a single non-terminal, applied regardless of surrounding symbols.

Report an error in this question

Programming FundamentalsHard

Q23. What is tail call optimization (TCO)?

  1. A.Optimizing the first function call in a chain
  2. B.Parallelizing multiple function calls at once
  3. C.Reusing the current stack frame for a tail call✓ Correct
  4. D.Removing unused function calls from the code

Explanation

TCO reuses the current function's stack frame when the recursive call is the last operation, preventing stack overflow.

Report an error in this question

Programming FundamentalsHard

Q24. What distinguishes a pure function in functional programming?

  1. A.It returns the same output for the same input always✓ Correct
  2. B.It cannot accept any parameters from the caller
  3. C.It modifies global state and external variables freely
  4. D.It must use recursion as its primary control flow

Explanation

A pure function produces the same result for identical inputs and causes no observable side effects.

Report an error in this question

Programming FundamentalsHard

Q25. What is referential transparency?

  1. A.A function that returns void and produces no output value
  2. B.An expression replaceable with its value without side effects✓ Correct
  3. C.A pointer that references itself in a circular data structure
  4. D.A variable that can be referenced from anywhere in the code

Explanation

Referential transparency means an expression can be substituted with its computed value without altering the program's behavior.

Report an error in this question

Programming FundamentalsHard

Q26. What is the difference between static and dynamic dispatch?

  1. A.Static dispatch is always slower than dynamic dispatch in practice
  2. B.Static dispatch resolves methods at compile time; dynamic at runtime✓ Correct
  3. C.They are identical concepts in object-oriented programming languages
  4. D.Dynamic dispatch is only available in the C programming language

Explanation

Static dispatch determines which function to call at compile time, while dynamic dispatch determines it at runtime using vtables or similar mechanisms.

Report an error in this question

Programming FundamentalsHard

Q27. What is a closure in programming?

  1. A.A method used to close open file handles
  2. B.A function bundled with its lexical scope✓ Correct
  3. C.A technique to terminate a running loop
  4. D.A destructor that cleans up class state

Explanation

A closure is a function that captures and retains access to variables from its enclosing lexical scope.

Report an error in this question

Programming FundamentalsHard

Q28. What is continuation-passing style (CPS)?

  1. A.A structured method for handling runtime errors
  2. B.Passing control explicitly via continuation functions✓ Correct
  3. C.A design pattern for building user interfaces
  4. D.Passing all arguments by reference to functions

Explanation

In CPS, instead of returning values, functions pass results to a continuation function that specifies what to do next.

Report an error in this question

Programming FundamentalsHard

Q29. What is homoiconicity in a programming language?

  1. A.All variables in the program share the same type
  2. B.The code can run on any platform without changes
  3. C.Code structure uses the language own data structures✓ Correct
  4. D.Functions return the exact same type they receive

Explanation

Homoiconicity means the program's source code is expressed using the language's fundamental data structures, as in Lisp.

Report an error in this question

Programming FundamentalsHard

Q30. What is the Curry-Howard correspondence?

  1. A.A technique for normalizing database tables
  2. B.A method for performing function currying
  3. C.A link between mathematical proofs and programs✓ Correct
  4. D.A protocol for networking between computers

Explanation

The Curry-Howard correspondence establishes a deep connection between logical proofs and typed programs.

Report an error in this question

Ready to test yourself on Programming Fundamentals?

Take a timed quiz drawn from 210+ questions on this topic. No signup required — your progress saves in your browser.

Start Programming Fundamentals Quiz