Syntax und Theorie Flashcards

1
Q

Nennen Sie zwei Typen von Collections

A

Set,(Hash)Map, (Array)List, Collection, array (auch erlaubt)

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

Definieren Sie eine ArrayList die Wahrheitswerte beinhaltet

A

ArrayList eineListe = new ArrayList<>();

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

Definieren Sie eine Fließkomma-Konstante mit dem Namen E und weisen Sie dieser den Wert
2.718f zu.

A

final float/double E = 2.718f;

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

Stellt die Umwandlung double a = 3231; eine explizite oder implizite Typumwandlung dar?

A

Eine implizite Typumwandlung

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

Haben Kommentare Einfluss auf die Ausführung eines Java-Programms?

A

Nein

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

Welche Bildschirmausgabe liefert die folgende Methode für i=21 und j=2?

public void method1(int i, int j) {
System.out.println(i + j + “ ist mein Ergebnis”);
}

A

23 ist mein Ergebnis

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

Welche Bildschirmausgabe liefert die folgende Methode für i=2 und j=3?

public void method2 (int i, int j) {
int[] array = {2,6,3,5};
System.out.println(array[i+1] * array[j]);
}

A

25

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

Welche Bildschirmausgabe liefert die folgende Methode für i=42?

public void method3(int i) {
System.out.println((double)i);
}

A

42.0

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

Welche Bildschirmausgabe liefert die folgende Methode für i=4 und j=4.999999?

public void method4(int i, double j) {
System.out.println(i < (int) j);
}

A

false

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

Welche Bildschirmausgabe liefert die folgende Methode?

 public void method5() {
 int s = 0;
 for (int i=0; i<=10; i++) {
 if ((i%4) == 1){
s += 1;
} else {
s -= 1;
}
 }
 System.out.println(s);
 }
A

-5

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

Welche Bildschirmausgabe liefert die folgende Methode bei Übergabe eines Arrays array, dass
die Werte [5,4,3,2,1] enthält?

public void method6(int[] array) {
if(array.length == 4){
System.out.println(array[array.length-1])
} else {
System.out.println(array[array.length-2])
}
}

A

2

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

Wie muss die Methode ergänzt werden, damit aus der übergebenen ArrayList a das Element an
der Position s gelöscht wird?

public String method7(ArrayList a, int s){
return a. ______ (s);
}

A

remove

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

Wie muss die abstrakte Methode ergänzt werden, damit die Methodendeklaration gültig ist?

public ______ void method8(int i, short j);

A

abstract

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
Ergänzen Sie einen zum gegebenen return-Ausdruck passenden Rückgabetyp der folgenden
Methode.
public \_\_\_\_\_\_\_ method9(String zahl) {
return "Integer";
}
A

String

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