Font size
WorksheetsJava Basic - 3 settimana corso dstech
Total questions: 93
Worksheet time: 2hrs 9mins
Quali delle seguenti affermazioni relative alle interfacce java è vera?
una interfaccia può definire campi non statici
i metodi di un'interfaccia hanno visibilità di accesso package
i campi di una interfaccia sono final
una interfaccia può estendere una classe astratta
Nel linguaggio Java, a cosa servono i costruttori?
Definire un metodo di un oggetto
Definire il codice per l'implementazione delle interfacce
definire le istruzioni da eseguire quando si istanzia un oggetto
È un metodo particolare per invocare il super()
cos'è il bytecode
La quantità di memoria allocata dinamicamente
La quantità di memoria allocata staticamente per le code di stampa
Il contenuto di un file di estensione class
il codice ASCII o UNICODE dei singoli Byte
Una classe è...
L'istanza di un oggetto
L'insieme delle dichiarazioni degli oggetti
Un modello astratto per una famiglia di oggetti con caratteristiche simili
Il nome che rappresenta un oggetto
Un programma contenente il metodo main()
Un oggetto è
colui che manda un messaggio
una istanza di una classe
un insieme di caratteristiche simili
una classe non astratta
un programma che rappresenta una classe
Un array monodimensionale (o vettore) è...
un insieme di valori ordinati
un insieme di dati dello stesso tipo
un insieme di dati individuabili tramite indice
una serie di valori vuoti
una serie ordinata di interi
Which data type gets returned from length() method in String class?
double
String
int
number
What will be the output of below code?
String statement = "Outfit of the day";
System.out.println(statement.Substring(3,6));
it of
tfit
fit
FIT
The following Syntax is used for?
class Subclass-name extends Superclass-name
{
//methods and fields
}
Polymorphism
Encapsulation
Inheritance
None of the above
Class Cat extends Animal. Which is NOT a valid declaration?
Cat x = new Cat();
Animal X = new Animal();
Cat x = new Animal();
Animal x = new Cat();
What index value is used to locate the last element in the nums ArrayList?
nums.size()-1
nums.length()-1
nums.size()
nums.length
Which statement below is the correct way to retrieve the first element in the nums ArrayList?
nums.get(0)
nums[0]
nums(0)
nums[1]
What will print when the following code executes?
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(7);
list.add(8);
list.add(9);
System.out.println(list.remove(0));
7
8
9
0
What is the keyword "final" used for in Java?
identify a constant
identify an integer
identify a string
Identify a final answer
2
5
7
9
13
20
-1 0 2 5
-1 0 3 7
-1 1 4 8
0 2 5 9
0 1 3 7
Java method (function/module) definitions can contain which of the following parts in their headers?
An access modifier such as public or private
An optional access specifier called static
a return type or void
all of the above
IronMan or Thor?
goDown();
what does the () mean?
Which of this command has errors? Select multiple
System.out.print("Hello World")
System.out.print(Hello World);
System.out.Print("Hello World);
System.out.print("Hello World");
What is output by the code? Pretend it says System.out.println
2
3
4
5
6
What is ouptut by the code? Pretend it says System.out.println
2
3
4
5
6
What is output by the code?
123
12
1234
12345
4321
123
12
1234
12345
4321
Pretend it says System.out.println
1383
83
1813
181383
1318
1 2 4 8 16 32 64
1 2 4 8 16 32
2 4 8 16 32 64
2 4 8 16 32
4 8 16 32 64
200 66 22 7 2
66 22 7 2
200 66 22 2
200 66 22
7
2
5
7
9
13
20
How many times does the for loop run?
2
3
4
5
Consider the following code segment:
Line 1: int a = 10;
Line 2: double b = 10.7;
Line 3: double c = a + b;
Line 4: int d = a + c;
Line 5: System.out.println(c + " " + d);
What will be output as a result of executing the code segment?
20 20
20.0 30
20.7 31
20.7 30.7
Nothing will be printed because of a compile-time error.
Consider the following code segment:
Line 1: int a = 10;
Line 2: double b = 10.7;
Line 3: int d = a + b;
Line 3 will not compile in the code segment above. With which of the following statements could we replace this line so that is compiles?
I. int d = (int) a + b;
II. int d = (int) (a + b);
III. int d = a + (int) b;
I
II
III
I and III
II and III
0
2.5
6
12.5
60
Assume that a, b, and c have been declared and initialized with int values. The expression
!(a > b || b <= c)
is equivalent to which of the following?
a > b && b <= c
a <= b || b > c
a <= b && b > c
a < b || b >= c
a < b && b >= c
Who invented Java?
James Gosling
Sergey Brin
Steve Jobs
Bill Gates
Tim Berners-Lee
What is the name of the Java mascot?
Duke
Ronny
Penguin
James
Jack
Which company owns Java?
Oracle
Microsoft
Apple
Intel
If I say the word "Algorithm" I am talking about what?
When we all go to a store called Rithim.
Algae that can DANCE!!!
A new dance move.
A list of steps you follow to finish a task.
The variable "trash" will store what value?
2
10
1
3
The expression will equate to what value?
5
false
true
6
What does the Java code print?
true
2 = 2
2
false
What will the code print?
Jimmy
Timmy
Potatoes
A blank line
What value is printed to the console?
true
W
false
L
What value is printed to the console?
This restaurant is not my favourite.
This restaurant is good.
This restaurant is fantastic!
I've never dined at this restaurant.
3
a = {0, 2, 3, 4} and v = 1?
a = {0, 2, 3, 4} and v = 2?
Given the nums ArrayList with the values [1, 2, 3, 4, 6], what code below can be used to add a 5 between the 4 and 6 in the list?
nums.add(4, 5)
nums.add(5, 4)
nums.add(5, 5)
nums.add(5)
What is printed as a result of executing the following code?
ArrayList<Integer> alist = new ArrayList<Integer>();
alist.add(1);
alist.add(2);
alist.remove(1);
alist.add(1, 3);
alist.set(1, 4);
alist.add(5);
System.out.println(alist);
[1, 4, 5]
[1, 4, 3, 5]
[2, 4, 5]
[2, 4, 3, 5]
What is their favourite food
Ice-cream
Tacos
Sushi
Pizza
What is your favourite
DC Comics
Marvel
Steps
Input ---> Process ---> Output
Input ---> Output ---> Process
Output ---> Process ---> Input
“Only your hatred can destroy me.”
Plato was a student to which philosopher?
Aristotle
Xenophon
Socrates
Thomas Aquinas
Cosa definisco quando implemento l'interfaccia comparable
un ordinamento al momento
un ordinamento naturale
la possibilità di salvare su file
la possibilità di usare una lista
L'interfaccia ________ serve a darci la possibilità di salvare su stream oggetti da noi costruiti
Comparable
Saverizable
Serializable
Corruptable
Possiamo gestire una eccezione con il solo Try, senza blocco catch?
Si, ma dobbiamo fare il throws
Si, ma dobbiamo fare il new throw
No, dobbiamo per forza mettere il catch
Si, a patto che chi richiami il metodo metta il catch
Cos'è una IndexOutOfBoundException
Una eccezione generata da un accesso ad un oggetto non inizializzato
Una eccezione generata da un blocco try catch scritto male
Una eccezione generata da un accesso inconsistente su un collezione
Una eccezione generata da un errore in compilazione
Cosa è una NullPointerException
Una eccezione generata da un oggetto inconsistente
Una eccezione generata da un file inesistente
Una eccezione generata da un pezzo di codice che accede al db danneggiato
Una eccezione generata da un tipo di base =0
If you were wanting to filter data, which clause would you use?
Where
Order by
From
Select
What is the correct order of clauses in a SQL statement?
SELECT, FROM, ORDER BY, WHERE
SELECT, FROM, WHERE, ORDER BY
SELECT, WHERE, FROM, ORDER BY
WHERE, FROM, SELECT, ORDER BY
Which example of the field name below is in camel case?
First Name
firstName
FIRSTNAME
firstname
Which of the queries is most likely to have produced this result?
ANSWER: SELECT id, name, year FROM movies WHERE year > 2010;
ANSWER: SELECT id, name, year FROM movies WHERE year < 2010;
ANSWER: SELECT * FROM movies WHERE year > 2010;
ANSWER: SELECT id, name, year FROM movies WHERE YEAR > 2010;
