2020 assesment Flashcards

1
Q

Classify and List any 6 of the java primitive data types as numerics and non-numerics

A

Numerics (Int, byte, short, long) , Non-numerics ( char, Boolean)

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

Define Declaration

A

A declaration statement associates a variable name with a type at compile time.
Ie. Int i= 0;

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

define an identifier

A

*We use identifiers to name variables (and many other things) in Java.
i.e int a; int refers to data type, a is an identifier which is the name of the variable

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

Define a literal

A

A literal is a source-code representation of a data-type value.
99 is a literal of type int .

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

Define an expression

A

An expression is a literal, a variable, or a sequence of operations on literals and/or variables that produces a value.

e.g
* Int a= I + 1 is an expression

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

c) Write a java program which prints the string hello world I am a new java programme

A

Write a java program which prints the string hello world I am a new java programme
Public class HelloWorld {
System.out.print.out(“ hello world”);
}
2 marks for correct class header, 2 marks for a print statement

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

In Java programming language what does statement statically-typed mean?

A

which means that all variables must first be declared before they can be used.

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

b) Explain the difference between an object and a class in Java

A

Class: A template that defines the properties (variables) and behavior (methods) of objects.
Object: An instance of a class that holds specific values for the properties defined in the class.

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