Font size
WorksheetsJava Valutazione Competenze e prerequisiti corso DSTech
Total questions: 95
Worksheet time: 2hrs 21mins
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
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 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
What is output by the code? Pretend it says System.out.println
2
3
4
5
6
123
12
1234
12345
4321
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.
The variable "trash" will store what value?
2
10
1
3
What will the code print?
Jimmy
Timmy
Potatoes
A blank line
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
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
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
MAVEN needs
web.xml
manifest.yml
pom.xml
all of them
Which of the below is a source code
management tool?
Jenkins
Maven
Git
Hudson
git commit command use to
push changes from local repo to central repo
stage changes
push changes from staging area to local repo
all of them
100
12
10
-2
None
I only
II only
III only
I and III only
A
B
C
D
E
A
B
C
D
E
-5
0
13
-1
12
What is the output?
x is 0
x is 1
x is 3
x is 4
What is the output?
6 3 0
3 0
3 0 -3
6 3
Dato questo snippet di codice
List<String> listaStringhe = Files.readAllLines(Paths.get(path));
quale delle seguenti affermazioni è vera?
possiamo generare una IOException
possiamo generare una NullPointerException
possiamo generare una FileNotFoundException
possiamo generare una ClassCastException
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 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
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
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
a = {0, 2, 3, 4} and v = 2?
a = {0, 2, 3, 4} and v = 1?
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
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 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;
JSP significa...
Java Server Programing
Java Standard Pages
Java Server Pages
Java Server Program
Riguardo l'MVC, quale affermazione è falsa?
Una servelt usa il Dispatcher per inviare i dati ai bean
Una JSP non deve modificare i beans ma solo leggerli
Una servlet deve calcolare dati e condividerli tramite bean con una o più JSP
Una servlet usa il meccanismo del forward per passare il controllo ad una JSP
Data l'espressione &{nome} all'interno di una JSP, quali (uno o più) dei seguenti codici NON è ad essa equivalente?
<%=pageContext.findAttribute("name") %>
<%= request.findAttribute("name")%>
<%=session.findAttribute("name")%>
<jsp:userBean id="name" type="somePackeage.SomeClass" scope="..."><%= name %>
Nessuna risposta è giusta
Ciclo di vita della servet. Quale affermazione è falsa? (una o più)
destroy è chiamata quando il server cancella la istanza della servlet
service è chiamata in un nuovo thread dal server ad ogni richiesta
doGet è chiamata da servic e e gestisce il messaggio GET
init è eseguita una sola volta al caricamento della servlet
Nessuna risposta è falsa
Quali sono i livelli di "scope" accessibili da una JSP?
application, page, cookie, context
page, cookie, request, session
jsp, request, session, application
page, response, servletContext, session
page, request, session, application
Quale sarà l'output risultante dell'esecuzione del seguente prezzo di codice JSP:
<% if(false) { %>
To be
<% } else { %>
or not to be
<% } %> ?
To be
or not to be
To be, or not to be
Codice errato
Quale frase riguardo Tomcat è corretta?
E' un ambiente di sviluppo per applicazioni web
Ha bisogno di Eclipse per essere utilizzato
E' un web container e gestisce solo pagine statiche
E' in grado di eseguire servlets
Cosa è strettamente necessario avere istallato per compilare ed eseguire servlets?
Java, Tomcat
Java, Tomcat, Eclipse
Java, un servlet container, un client HTTP
Java, Tomcat, Eclipse, Firefox
Una servlet deve estendere..
la classe HTTPServlet
la classe HTTPServletRequest
la classe HTTPServletResponse
la classe GenericServlet
Quale metodo NON fa parte della gestione della vita di una servlet?
doGet()
doPost()
close()
init()
destroy()
String myString1 = "abc";
String myString2 = "ABC";
What is the return type of executeQuery() method?
int
ResultSet
array
none of the above
What is JDBC?
JDBC is a java based protocol.
JDBC is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases.
JDBC is a specification to tell how to connect to a database.
Joint Driver for Basic Connection
Which of the following encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed?
DriverManager
JDBC driver
Connection
Statement
Which of the following is correct about PreparedStatement?
Used when you plan to use the SQL statements many times.
The PreparedStatement interface accepts input parameters at runtime.
Both of the above.
None of the above.
