True or False Flashcards

1
Q

Non-primitive data types can be used to call methods to perform operations, while primitive data types cannot.

A

True

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

A primitive data type always has a value, while the value of non-primitive data type can be null.

A

True

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

A primitive data type starts with a uppercase letter, while non-primitive data type starts with a lowercase letter.

A

False

A primitive data type starts with a lowercase letter, while non-primitive data type starts with an uppercase letter.

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

When we assign reference values to an object, the data type of the variable and object MUST match in order for the assignment to be successful.

A

True

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

If you are still initializing a variable, it cannot have a value.

A

False

A variable can have a value depending on the variable’s data type.

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

When you pass a variable to a method, you are passing the variable’s value.

A

True

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

Local variables are still not created when you enter a method.

A

False

Local variables are automatically created when you enter a method, and it is automatically destroyed when you exit the method.

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

String is an object.

A

True

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

You can call another constructor within the same class by creating an object at the first line of the body of another constructor.

A

False

You can call another constructor within the same class by using the this() at the first line of the body of another constructor.

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

We can instantiate a class by initializing or creating an object and giving it a unique name.

A

True

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

Yes, you declare an Array.

Ex:
int[] car, headphone;
or
int car[], headphone[];

A

True

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

Is this syntax right for initializing the Array?

quiz[] = new int (5);

A

False

quiz = new int[5];

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

Is this syntax right for adding values in Array?

String[] alphabet = new int {“a”, “b”, “c”, “d”};

A

False

String[] alphabet = {“a”, “b”, “c”, “d”};

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

The segment below will work, however the output is wrong.

String[] arr = {“earth”, “water”, “air”};
System.out.println(arr);

A

True

The output is [Ljava.lang.String;@79fc0f2f

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

Will this segment run?

String[] arr = {“earth”, “water”, “air”};

    for(int i : arr){
        System.out.println(i);
    }
A

False

The array type must match the array type of the index

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

Will this segment run?

String[] arr = {“earth”, “water”, “air”};

    for(String i : arr){
        System.out.println(arr);
    }
A

True

However, the output is wrong.

17
Q

Arrays in Java are mutable.

A

False

Arrays in Java are immutable. Once an array size has been declared, you can no longer increase or decrease the size of it.

18
Q

Will this segment work?

String orig[] = {“2”,”5”,”6”,”7”};
String temp[] = new String[5];
System.arraycopy(orig, 0, temp , 0, orig.length);

    for(String i : temp)
    System.out.println(i);
A

True

The output is:
2
5
6
7
null

19
Q

This segment is legal:

int[][] twoDim = new int[][4];
int[4][4] twoDim = new int[][];

A

False

int[][] twoDim = new int[4][];
int[][] twoDim = newint[4][4];

20
Q

This segment is an example of ___ array.

int[][] array = new int[4][];
array[0] = new int[3];

A
21
Q

The super keyword is also used to avoid redundancy.

A

True

22
Q

Inheritance is a feature that allows you to carry over methods and variables to a subclass

A

True

23
Q
A
24
Q
A
25
Q
A
26
Q
A