Fundamentals of Programming Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a User-defined data type?

A

A data type derived from an existing datatype; like an instance of a class.

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

How do you do an XOR operation?

A

If same, 0

If different, 1

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

What is exception handling?

A

A try-catch; the process of handling errors which occur during runtime – usually causing the program to crash.

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

What is a class?

A

A blueprint for creating objects

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

What is an object?

A

An instance of a class

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

What is instantiation?

A

The process of creating an object

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

What is encapsulation?

A

Encapsulation means grouping together related data and methods and controlling access to this data by hiding the implementation details from other parts of the program.

This way, only specific parts of the code can interact with the data, ensuring controlled access and modification.

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

What is inheritance?

A

When a child class inherits attributes/methods from a parent class

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

What is aggregation?

A

A relationship where one class contains a reference to another class, but both can exist independently.

A weak “has a” relationship. If the object is destroyed, the objects it references will continue to exist.

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

What is composition?

A

A relationship where one class contains another class, and the contained class cannot exist independently of the containing class.

A strong “part of” relationship. If the object is destroyed, the ones contained within are also destroyed.

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

What is function overriding?

A

When a method is defined in the parent class, then “overridden” in the child class giving it a different functionality.

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

What is Modulus ?

A

% - means to find the remainder when a number is divided by another number

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

What is a benefit of Encapsulation

A

Encapsulation allows for parts of a program
to be modified without affecting the entire program, as the implementation of methods can be changed without
changing how the methods are used.

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

What is meant by a virtual method?

A

You declare it in the parent class:

public virtual void sayHello() {
// Some code here
}

Then in a child class, you override it:

public override void sayHello() {
cw(“Hiiiiii”);
}

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

What is meant by an abstract method?

A

You declare it in the parent class, where the class is an abstract class:

public abstract void sayHello();

Then in a child class, you override it:

public override void sayHello() {
cw(“Hiiiiii”);
}

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

What’s the difference between virtual and abstract methods?

A

Virtual methods: Methods in a parent class that can be changed in derived classes but already have some code. And don’t have to be overriden in child classes.

Abstract methods: Methods in a parent class with no code that must be overrided in derived classes.

17
Q

What is Polymorphism?

A

A method shared (up and down the inheritance hierarchy chain) but with each class / method implementing it differently.

18
Q

What is Object Orientated Programming?

A

A method of programming which classifies real-world objects and encapsulates those objects’ attributes and behaviours.