wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java Valutazione Competenze e prerequisiti corso DSTech

Total questions: 95

Worksheet time: 2hrs 21mins

Name
Class
Date
1.

Quali delle seguenti affermazioni relative alle interfacce java è vera?

a)

una interfaccia può definire campi non statici

b)

i metodi di un'interfaccia hanno visibilità di accesso package

c)

i campi di una interfaccia sono final

d)

una interfaccia può estendere una classe astratta

2.

Nel linguaggio Java, a cosa servono i costruttori?

a)

Definire un metodo di un oggetto

b)

Definire il codice per l'implementazione delle interfacce

c)

definire le istruzioni da eseguire quando si istanzia un oggetto

d)

È un metodo particolare per invocare il super()

3.

cos'è il bytecode

a)

La quantità di memoria allocata dinamicamente

b)

La quantità di memoria allocata staticamente per le code di stampa

c)

Il contenuto di un file di estensione class

d)

il codice ASCII o UNICODE dei singoli Byte

4.

Una classe è...

a)

L'istanza di un oggetto

b)

L'insieme delle dichiarazioni degli oggetti

c)

Un modello astratto per una famiglia di oggetti con caratteristiche simili

d)

Il nome che rappresenta un oggetto

e)

Un programma contenente il metodo main()

5.

Un oggetto è

a)

colui che manda un messaggio

b)

una istanza di una classe

c)

un insieme di caratteristiche simili

d)

una classe non astratta

e)

un programma che rappresenta una classe

6.

Un array monodimensionale (o vettore) è...

a)

un insieme di valori ordinati

b)

un insieme di dati dello stesso tipo

c)

un insieme di dati individuabili tramite indice

d)

una serie di valori vuoti

e)

una serie ordinata di interi

7.
When we want to print in Java, we use the code ......
a)
system.out.print();
b)
System.out.println();
c)
System.Out.Printf();
d)
System.out.show();
8.

Which data type gets returned from length() method in String class?

a)

double

b)

String

c)

int

d)

number

9.

The following Syntax is used for?


class Subclass-name extends Superclass-name

{

//methods and fields

}

a)

Polymorphism

b)

Encapsulation

c)

Inheritance

d)

None of the above

10.

Class Cat extends Animal. Which is NOT a valid declaration?

a)

Cat x = new Cat();

b)

Animal X = new Animal();

c)

Cat x = new Animal();

d)

Animal x = new Cat();

11.

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));

a)

7

b)

8

c)

9

d)

0

12.

What is the keyword "final" used for in Java?

a)

identify a constant

b)

identify an integer

c)

identify a string

d)

Identify a final answer

13.
These controls the behavior of a program.
a)
class
b)
object
c)
method
d)
void
14.
What happens if a variable or method is made private?
a)
It can be accessed by any class inherited from the current class
b)
It can be accessed from another object unrelated to the current one.
c)
It cannot be accessed by an unrelated object from the outside.
d)
It cannot be accessed by anything
15.

2

a)

5

b)

7

c)

9

d)

13

e)

20

16.
a)

-1 0 2 5

b)

-1 0 3 7

c)

-1 1 4 8

d)

0 2 5 9

e)

0 1 3 7

17.
Which is the correct way to declare an ArrayList of Strings in Java?
a)
ArrayList<String>
b)
ArrayList(String)
c)
ArrayList[String]
d)
ArrayList{String}
18.
_______ is how we write code
a)
Syntax
b)
Loops
c)
Variables
d)
Functions
19.

What is output by the code? Pretend it says System.out.println

a)

2

b)

3

c)

4

d)

5

e)

6

20.
a)

123

b)

12

c)

1234

d)

12345

e)

4321

21.

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?

a)

20 20

b)

20.0 30

c)

20.7 31

d)

20.7 30.7

e)

Nothing will be printed because of a compile-time error.

22.

The variable "trash" will store what value?

a)

2

b)

10

c)

1

d)

3

23.

What will the code print?

a)

Jimmy

b)

Timmy

c)

Potatoes

d)

A blank line

24.

What value is printed to the console?

a)

This restaurant is not my favourite.

b)

This restaurant is good.

c)

This restaurant is fantastic!

d)

I've never dined at this restaurant.

e)

3

25.

Cosa definisco quando implemento l'interfaccia comparable

a)

un ordinamento al momento

b)

un ordinamento naturale

c)

la possibilità di salvare su file

d)

la possibilità di usare una lista

26.

L'interfaccia ________ serve a darci la possibilità di salvare su stream oggetti da noi costruiti

a)

Comparable

b)

Saverizable

c)

Serializable

d)

Corruptable

27.

Cosa è una NullPointerException

a)

Una eccezione generata da un oggetto inconsistente

b)

Una eccezione generata da un file inesistente

c)

Una eccezione generata da un pezzo di codice che accede al db danneggiato

d)

Una eccezione generata da un tipo di base =0

28.
MySQL is
a)
A Programming language
b)
A technique for writing reliable programs
c)
 A Relational Database Management System
d)
None of the Above
29.
What does "Select" command do at MySQL database? 
a)
Write.
b)
Read.
c)
Delete.
d)
Update.
30.
What should a primary key contain?
a)
A lot of different values
b)
A null value
c)
An unique value
31.

MAVEN needs

a)

web.xml

b)

manifest.yml

c)

pom.xml

d)

all of them

32.

Which of the below is a source code

management tool?

a)

Jenkins

b)

Maven

c)

Git

d)

Hudson

33.

git commit command use to

a)

push changes from local repo to central repo

b)

stage changes

c)

push changes from staging area to local repo

d)

all of them

34.
What does "Insert into" command do at MySQL? 
a)
Delete.
b)
Database.
c)
MySQL.
d)
Write
35.
A database entity is also known as:
a)
a table
b)
a field
c)
a row
d)
a report
36.
git pull
a)
Places the changes to the repository
b)
Takes the changes from the repository
c)
Is not a command
37.
a)

100

b)

12

c)

10

d)

-2

38.
a)

None

b)

I only

c)

II only

d)

III only

e)

I and III only

39.
a)

A

b)

B

c)

C

d)

D

e)

E

40.
a)

A

b)

B

c)

C

d)

D

e)

E

41.
a)

-5

b)

0

c)

13

d)

-1

e)

12

42.
The ____ method executes first in an application, regardless of where you physically place it within its class.
a)
execute()
b)
main()
c)
start()
d)
run()
43.

What is the output?

a)

x is 0

b)

x is 1

c)

x is 3

d)

x is 4

44.

What is the output?

a)

6 3 0

b)

3 0

c)

3 0 -3

d)

6 3

45.

Dato questo snippet di codice


List<String> listaStringhe = Files.readAllLines(Paths.get(path));


quale delle seguenti affermazioni è vera?

a)

possiamo generare una IOException

b)

possiamo generare una NullPointerException

c)

possiamo generare una FileNotFoundException

d)

possiamo generare una ClassCastException

46.
Java is highly portable because 
a)
it creates a single executable file that works on all computers.
b)
it creates a single byte code file that is interpreted at the user's computer.
c)
everyone uses it.
d)
it says so in the text book.
47.
If a method of a class is defined like this:
goDown();
what does the () mean?
a)
It requires data to be passed in
b)
It has no parameters
c)
It can be called from BlueJ
48.

Which of this command has errors? Select multiple

a)

System.out.print("Hello World")

b)

System.out.print(Hello World);

c)

System.out.Print("Hello World);

d)

System.out.print("Hello World");

49.

What is ouptut by the code? Pretend it says System.out.println

a)

2

b)

3

c)

4

d)

5

e)

6

50.

What is output by the code?

a)

123

b)

12

c)

1234

d)

12345

e)

4321

51.
a)

123

b)

12

c)

1234

d)

12345

e)

4321

52.

Pretend it says System.out.println

a)

1383

b)

83

c)

1813

d)

181383

e)

1318

53.
a)

1 2 4 8 16 32 64

b)

1 2 4 8 16 32

c)

2 4 8 16 32 64

d)

2 4 8 16 32

e)

4 8 16 32 64

54.
a)

200 66 22 7 2

b)

66 22 7 2

c)

200 66 22 2

d)

200 66 22

e)

7

55.

2

a)

5

b)

7

c)

9

d)

13

e)

20

56.

How many times does the for loop run?

a)

2

b)

3

c)

4

d)

5

57.
a)

0

b)

2.5

c)

6

d)

12.5

e)

60

58.

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)

a > b && b <= c

b)

a <= b || b > c

c)

a <= b && b > c

d)

a < b || b >= c

e)

a < b && b >= c

59.

The expression will equate to what value?

a)

5

b)

false

c)

true

d)

6

60.

What does the Java code print?

a)

true

b)

2 = 2

c)

2

d)

false

61.

What will the code print?

a)

Jimmy

b)

Timmy

c)

Potatoes

d)

A blank line

62.

What value is printed to the console?

a)

true

b)

W

c)

false

d)

L

63.
Given the following method, what would test return if
a = {0, 2, 3, 4} and v = 2?
a)
0
b)
1
c)
2
d)
-1
64.
Given the following method, what would test return if
a = {0, 2, 3, 4} and v = 1?
a)
-1
b)
0
c)
1
d)
2
65.

Cos'è una IndexOutOfBoundException

a)

Una eccezione generata da un accesso ad un oggetto non inizializzato

b)

Una eccezione generata da un blocco try catch scritto male

c)

Una eccezione generata da un accesso inconsistente su un collezione

d)

Una eccezione generata da un errore in compilazione

66.
What is this code do ?
a)
Read all from staff table.
b)
Write from staff table.
c)
Update all from table.
d)
Drop table.
67.

What is the correct order of clauses in a SQL statement?

a)

SELECT, FROM, ORDER BY, WHERE

b)

SELECT, FROM, WHERE, ORDER BY

c)

SELECT, WHERE, FROM, ORDER BY

d)

WHERE, FROM, SELECT, ORDER BY

68.
When you select data from 2 tables, you are creating a ________. 
a)
JOIN
b)
PRIMARY KEY
c)
FOREIGN KEY
d)
INDEX
69.
To join a table, connect the ___________ of one table to the ___________ of the other.
a)
primary key, foreign key
b)
group by clause, primary key
c)
filtered by, foreign key
d)
aggregate function, where clause
70.

Which of the queries is most likely to have produced this result?

a)

ANSWER: SELECT id, name, year FROM movies WHERE year > 2010;

b)

ANSWER: SELECT id, name, year FROM movies WHERE year < 2010;

c)

ANSWER: SELECT * FROM movies WHERE year > 2010;

d)

ANSWER: SELECT id, name, year FROM movies WHERE YEAR > 2010;

71.

JSP significa...

a)

Java Server Programing

b)

Java Standard Pages

c)

Java Server Pages

d)

Java Server Program

72.

Riguardo l'MVC, quale affermazione è falsa?

a)

Una servelt usa il Dispatcher per inviare i dati ai bean

b)

Una JSP non deve modificare i beans ma solo leggerli

c)

Una servlet deve calcolare dati e condividerli tramite bean con una o più JSP

d)

Una servlet usa il meccanismo del forward per passare il controllo ad una JSP

73.

Data l'espressione &{nome} all'interno di una JSP, quali (uno o più) dei seguenti codici NON è ad essa equivalente?

a)

<%=pageContext.findAttribute("name") %>

b)

<%= request.findAttribute("name")%>

c)

<%=session.findAttribute("name")%>

d)

<jsp:userBean id="name" type="somePackeage.SomeClass" scope="..."><%= name %>

e)

Nessuna risposta è giusta

74.

Ciclo di vita della servet. Quale affermazione è falsa? (una o più)

a)

destroy è chiamata quando il server cancella la istanza della servlet

b)

service è chiamata in un nuovo thread dal server ad ogni richiesta

c)

doGet è chiamata da servic e e gestisce il messaggio GET

d)

init è eseguita una sola volta al caricamento della servlet

e)

Nessuna risposta è falsa

75.

Quali sono i livelli di "scope" accessibili da una JSP?

a)

application, page, cookie, context

b)

page, cookie, request, session

c)

jsp, request, session, application

d)

page, response, servletContext, session

e)

page, request, session, application

76.

Quale sarà l'output risultante dell'esecuzione del seguente prezzo di codice JSP:

<% if(false) { %>

To be

<% } else { %>

or not to be

<% } %> ?

a)

To be

b)

or not to be

c)

To be, or not to be

d)

Codice errato

77.

Quale frase riguardo Tomcat è corretta?

a)

E' un ambiente di sviluppo per applicazioni web

b)

Ha bisogno di Eclipse per essere utilizzato

c)

E' un web container e gestisce solo pagine statiche

d)

E' in grado di eseguire servlets

78.

Cosa è strettamente necessario avere istallato per compilare ed eseguire servlets?

a)

Java, Tomcat

b)

Java, Tomcat, Eclipse

c)

Java, un servlet container, un client HTTP

d)

Java, Tomcat, Eclipse, Firefox

79.

Una servlet deve estendere..

a)

la classe HTTPServlet

b)

la classe HTTPServletRequest

c)

la classe HTTPServletResponse

d)

la classe GenericServlet

80.

Quale metodo NON fa parte della gestione della vita di una servlet?

a)

doGet()

b)

doPost()

c)

close()

d)

init()

e)

destroy()

81.
method used to send request and response objects to another servlet in RequestDispacher
a)
forward()
b)
sendRedirect()
c)
Both A & B
d)
None of the above
82.
In HTTP Request method Get request is secured because data is exposed in URL bar
a)
true
b)
false
83.
Servlet technology is used to create web application
a)
true
b)
false
84.
in which folder we can put web.xml
a)
classes
b)
package
c)
WEB-INF
d)
web apps
85.
Which searching algorithm is the most efficient when dealing with large data sets?
a)
Sequential Search
b)
Linear Search
c)
Binary Search
d)
Local Search
86.
What is a flowchart?
a)
A flowchart is a useful picture that helps break down your algorithm into a series of easily understood   questions, answers, and actions.
b)
A flowchart is a test plan that encompasses all of the decisions in your code.
c)
A flowchart is a sequence of steps your program takes to solve a problem.
d)
A flowchart is a written description of the overall work
87.
The exact sequence of steps your program takes to solve a problem is called a _________.
a)
Algorithm
b)
flowchart
c)
factor
d)
problem
88.
What is a recursive function?
a)
A function that calls another function
b)
A function which calls itself
c)
A function that contains a program loop
d)
A function that returns a value
89.
A Collection represents a group of individual elements but does not give any clues how the elements are   stored within the class.
a)
True
b)
False
90.
Given the code below, is it true that myString1.equals(myString2) and myString2.equals(myString1) will produce the same result?  
String myString1 = "abc";
String myString2 = "ABC";
a)
True
b)
False
91.
You are able to implement as many interfaces as you like on a single class
a)
True
b)
False
92.

What is the return type of executeQuery() method?

a)

int

b)

ResultSet

c)

array

d)

none of the above

93.

What is JDBC?

a)

JDBC is a java based protocol.

b)

JDBC is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases.

c)

JDBC is a specification to tell how to connect to a database.

d)

Joint Driver for Basic Connection

94.

Which of the following encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed?

a)

DriverManager

b)

JDBC driver

c)

Connection

d)

Statement

95.

Which of the following is correct about PreparedStatement?

a)

Used when you plan to use the SQL statements many times.

b)

The PreparedStatement interface accepts input parameters at runtime.

c)

Both of the above.

d)

None of the above.