OOP - Week 1 Flashcards

1
Q

Why is Object Oriented Programming useful

A

It makes programming similar to thinking about the real world

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

What is the name of variables in an object

A

Fields

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

What is the name of functions in an object

A

Methods

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

How are objects created

A

Using classes

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

Advantages of OOP vs Procedural

A

More secure, readable and reusable, easier to maintain/debug

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

Disadvantages of OOP vs Procedural

A

Needs more lines of code
Slower programs
Steep learning curve

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

What do {} do for classes

A

They mark the body of the class

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

What must a java app have

A

A main method as an execution point of the program

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

What is the signature of the main() method

A

public static void main(String[] args)

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

Commenting in Java

A

Single line - //

Multi line - /* */

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

Variable steps

A

Declaration - Data type and name
Initialisation - Initial value
Assignment - Value replacement

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

What are the java float data types

A

Float (32-bit)

Double (64-bit)

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

What do x++ and x– mean

A

x+1 and x-1

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

What is the difference between b=a++ and b=++a

A

b=a++ adds 1 to a after making b equal to a

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

How to make a float not count as a double

A

Add f to the end of the number

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

When are two data types automatically converted

A

When the two data types are compatible

When a smaller value is assigned to a bigger data type (e.g float to double)