Basics Flashcards

1
Q

What is the principle of Encapsulation in programming?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or False: Inheritance allows a class to inherit properties and methods from another class.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a control structure?

A

A control structure is a block of programming that determines the flow of control in a program based on certain conditions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

True or False: Control structures can only be used with conditional statements.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Fill in the blank: The three main types of control structures are ____, ____, and ____.

A

sequential, selection, iteration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which control structure would you use to execute a block of code multiple times?

A

Iteration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the purpose of a ‘switch’ statement in programming?

A

A ‘switch’ statement allows the execution of different parts of code based on the value of a variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly