Basics Flashcards
What is the principle of Encapsulation in programming?
Encapsulation is the principle of bundling data and methods that operate on that data within one unit, such as a class, restricting access to some of the object’s components.
True or False: Inheritance allows a class to inherit properties and methods from another class.
True
What is a control structure?
A control structure is a block of programming that determines the flow of control in a program based on certain conditions.
True or False: Control structures can only be used with conditional statements.
False
Fill in the blank: The three main types of control structures are ____, ____, and ____.
sequential, selection, iteration
Which control structure would you use to execute a block of code multiple times?
Iteration
What is the purpose of a ‘switch’ statement in programming?
A ‘switch’ statement allows the execution of different parts of code based on the value of a variable.