Programming Fundamentals
Question #1
Q: What is the difference between compiled and interpreted languages?
A: Compiled languages are translated into machine code before execution; interpreted languages are executed line-by-line at runtime.
Question #2
Q: What is a variable and why do we use it?
A: A variable is named storage for data, used to hold and manipulate values in a program.
Question #3
Q: What’s the difference between == and === in JavaScript?
A: == allows type coercion; === requires both the type and the value to match.
Question #4
Q: What is a data type?
A: A data type describes the kind of value a variable can hold, such as string, number, or boolean.
Question #5
Q: What is the difference between null and undefined?
A: null is an intentionally empty value; undefined means a variable has been declared but not assigned.
Question #6
Q: What’s the difference between stack and heap memory?
A: The stack stores function calls and local variables; the heap stores dynamically allocated objects.
Question #7
Q: What does it mean when a language is statically typed?
A: Types are checked at compile time, and variables must have known, declared types.
Question #8
Q: What does it mean when a language is dynamically typed?
A: Types are checked at runtime, and variables can change type while the program is running.
Question #9
Q: What is a strongly typed language?
A: A strongly typed language enforces strict type rules and avoids unexpected implicit type conversions.
Question #10
Q: What is a weakly typed language?
A: A weakly typed language performs automatic type conversions even when they may be surprising or unintended.
Question #11
Q: What is type coercion?
A: Automatic conversion of one data type into another, often done in weakly typed languages.
Question #12
Q: What is a constant?
A: A constant is a variable that cannot be reassigned after its initial value is set.
Question #13
Q: What is a literal?
A: A literal is a fixed value written directly in code, such as "hello" or 42.
Question #14
Q: What is an expression?
A: An expression is code that evaluates to a value, such as a + b.
Question #15
Q: What is a statement?
A: A statement is a complete instruction executed by a program, like let x = 10;.
Question #16
Q: What is a keyword in programming?
A: A reserved word with special meaning in a language, such as if, return, or class.
Question #17
Q: What is a syntax error?
A: A mistake in the structure of code that prevents it from running, like unmatched brackets.
Question #18
Q: What is a runtime error?
A: An error that occurs while a program is running, such as accessing an undefined variable.
Question #19
Q: What is a semantic error?
A: A mistake where the program runs but does not behave as intended.
Question #20
Q: What is a comment?
A: Text included in the code for humans to read; it is ignored by the computer.
Question #21
Q: What are operators in programming?
A: Symbols that perform actions on values, such as +, -, *, /, or &&.
Question #22
Q: What is type casting?
A: Manually converting a value from one type to another.
Question #23
Q: What is immutability?
A: A property where a value cannot be changed after it is created.
Question #24
Q: What is an exception?
A: An event that represents an error or unexpected condition during program execution.
Question #25
Q: What is exception handling?
A: Code that catches and responds to exceptions so a program can recover instead of crashing.
Question #26
Q: What is a library?
A: A collection of prewritten functions or utilities that can be reused in programs.
Question #27
Q: What is a framework?
A: A structured environment that provides tools, patterns, and rules for building applications.
Question #28
Q: What is an IDE?
A: An Integrated Development Environment — software that provides tools like editing, debugging, and building.