All flashcards
Flashcard 1: What is encapsulation in object-oriented programming?
Answer: Bundling data with methods that operate on the data. Data hiding principle combining related data and functions together.
Flashcard 2: Identify the error: 'if (x = 10)'
Answer: Correct: 'if (x == 10)'. Single '=' assigns value; '==' compares for equality in conditions.
Flashcard 3: Which loop executes at least once regardless of condition?
Answer: Do-while loop. Condition checked after execution, guaranteeing minimum one iteration.
Flashcard 4: What is a syntax error?
Answer: An error in the code's grammar or structure. Violates language rules preventing code from compiling or running.
Flashcard 5: What is a recursive function?
Answer: A function that calls itself. Solves problems by breaking them into smaller identical subproblems.
Flashcard 6: What does 'DRY' stand for in programming?
Answer: Don't Repeat Yourself. Principle promoting code reusability by avoiding duplication.
Flashcard 7: Find and correct the error: 'for(int i = 0; i < 10; i+)'
Answer: Correct: 'for(int i = 0; i < 10; i++)'. Missing second '+' in increment operator; should be 'i++'.
Flashcard 8: What is the role of an algorithm in program design?
Answer: To outline the step-by-step solution to a problem. Provides clear, logical sequence of instructions to solve problems.
Flashcard 9: Which programming construct is used for decision making?
Answer: Conditional statements. if-else and switch statements control program flow based on conditions.
Flashcard 10: Identify the first step in the program development life cycle.
Answer: Problem analysis. Understanding requirements before designing solutions is essential first step.
Flashcard 11: What is the primary purpose of program documentation?
Answer: To explain code logic and facilitate future maintenance. Comments and structure make code understandable for others and future edits.
Flashcard 12: Which data structure uses LIFO order?
Answer: Stack. Last In, First Out - elements added/removed from same end.
Flashcard 13: Identify the error: 'switch(x) { case 1: x+=1; break; default: x-=1; }'
Answer: No error. Proper switch syntax with break statements and default case.
Flashcard 14: What is the purpose of version control in software development?
Answer: To manage changes to source code over time. Tracks modifications, enables collaboration, and maintains code history.
Flashcard 15: What is an API?
Answer: Application Programming Interface. Interface defining how software components communicate and interact.
Flashcard 16: What is the difference between a class and an object?
Answer: Class is a blueprint; object is an instance. Template defines structure; instance contains actual data values.
Flashcard 17: What is a variable's scope?
Answer: The region of code where the variable is accessible. Determines where variables can be accessed within program structure.
Flashcard 18: What is the purpose of a loop in programming?
Answer: To repeat a block of code multiple times. Automates repetitive tasks by controlling iteration and flow.
Flashcard 19: Identify the error: 'if (x > y) x = 10; else; y = 10;'
Answer: Remove ';' after else. Semicolon after else creates syntax error in conditional structure.
Flashcard 20: What is inheritance in object-oriented programming?
Answer: Mechanism for one class to inherit attributes and methods from another. Child classes acquire properties and behaviors from parent classes.
Flashcard 21: What is the function of a compiler?
Answer: To convert source code into machine code. Translates high-level code into executable machine instructions.
Flashcard 22: What is the difference between 'public' and 'private' access modifiers?
Answer: 'public' is accessible everywhere; 'private' is within the same class. Controls visibility and access levels for class members.
Flashcard 23: Find and correct the error: 'int x = "100";'
Answer: Correct: 'int x = 100;'. String literal assigned to integer variable causes type mismatch.
Flashcard 24: What is a function's return type?
Answer: The data type of the value returned by the function. Specifies what kind of value the function sends back.
Flashcard 25: What is an IDE?
Answer: Integrated Development Environment. Software providing comprehensive tools for coding, debugging, and testing.
Flashcard 26: Identify the error: 'int x = 10; float y = x / 0;'
Answer: Division by zero error. Mathematical impossibility that causes runtime exception or undefined behavior.
Flashcard 27: What is abstraction in programming?
Answer: Hiding complex implementation details behind simple interfaces. Simplifies complexity by exposing only essential features to users.
Flashcard 28: Which method is the entry point for a Java application?
Answer: main method. Starting point where JVM begins program execution.
Flashcard 29: What does 'MVC' stand for in software design?
Answer: Model-View-Controller. Architectural pattern separating presentation, logic, and data concerns.
Flashcard 30: Find and correct the error: 'int[] arr = new int(5);'
Answer: Correct: 'int[] arr = new int[5];'. Square brackets for arrays, not parentheses like method calls.