Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

jsp e servlets

Total questions: 40

Worksheet time: 21mins

Name
Class
Date
1.

Which one is the correct order of phases in JSP life cycle?

a)

Initialization, Cleanup, Compilation, Execution

b)

Initialization, Compilation, Cleanup, Execution

c)

Compilation, Initialization, Execution, Cleanup

d)

Cleanup, Compilation, Initialization, Execution

2.

Identify the decreasing order of scopes in jsp.

a)

session, application, page, request

b)

application, session, response, page

c)

application, session, request, page

d)

session, application, request, page

3.

Which attribute specifies a JSP page that should process any exceptions thrown but not caught in the current page?

a)

The ErrorPage Attribute

b)

The IsErrorPage Attribute

c)

autoflush

d)

isThreadSafe

4.

Java code is embedded under which tag in JSP?

a)

Declaration

b)

Scriptlet

c)

Expression

d)

Comment

5.

Which of the following are the valid scopes in JSP?

a)

request, page, session, application

b)

request, page, session, global

c)

response, page, session, application

d)

request, page, context, application

6.

Choose an incorrect statement from the following.

a)

JSP pages are easier to maintain than a servlet.

b)

The Web Container translate a Servlet into JSP page.

c)

JSP is built on Java Technology so it is platform independent.

d)

A JSP page seperates presentation and business logic.

7.

Which of the following is syntax of Declaration Tag?

a)

<@ Declaration @>

b)

<% Declaration %>

c)

<& Declaration &>

d)

<%! Declaration %>

8.

Which is an example of the syntax used to import a class to JSP?

a)

<% page import="java.util.List" %>

b)

<%@ page import="java.util.List" @%>

c)

<% import="java.util.List" %>

d)

<%@ page import="java.util.List" %>

9.

Which of the following is syntax of Expression Tag?

a)

<% Expression %>

b)

<%= Expression %>

c)

<& Expression &>

d)

<%! Expression %>

10.

Choose the correct syntax of include directive?

a)

<%@ include page="file.jsp" %>

b)

<% include file="file.jsp" %>

c)

<%@ include file="file.jsp" %>

d)

<%! include page="file.jsp" %>

11.

Quale frase riguardo Tomcat è corretta?

a)

E' un ambiente di sviluppo per applicazioni web

b)

Ha bisogno di IntelliJ per essere utilizzato

c)

E' un web container e gestisce solo pagine statiche

d)

E' in grado di eseguire servlets

12.

Indicare la frase corretta riguardo IntelliJ e lo sviluppo Web

a)

E' indispensabile per lo sviluppo web

b)

Permette di sviluppare applicazioni web ed eseguirle tramite una virtualizzazione di Tomcat

c)

Ha bisogno solo delle librerie fornite con Java per compilare ed eseguire servlet

d)

La gerarchia delle cartelle che contengono i files di un'applicazione web in IntelliJ è identica a quella che si ritrova in Tomcat/webapp

13.

Cosa è servlet_api.jar

a)

E' una libreria Java per la compilazione/esecuzione di servlet

b)

E' una libreria distribuita con il jdk/jre di Java

c)

E' una libreria Java distribuita con Tomcat ed è identica per ciascuna distribuzione di Tomcat

d)

E' una libreria Java distribuita con IntelliJ

14.

Choose the correct HTML element for the largest heading:

a)

<h6>

b)

<heading>

c)

<h1>

d)

<head>

e)

Non capisco la domanda per via dell'Inglese

15.

What is the function of the <p> tag?

a)

Defines a paragraph.

b)

Makes the text purple.

c)

It pushes the text to the right.

d)

Prints the webpage.

e)

Non capisco la domanda per via dell'Inglese

16.

Name an element which doesn't have a closing tag.

a)

<img>

b)

<head>

c)

<body>

d)

<p>

e)

Non capisco la domanda per via dell'Inglese

17.

The content of the web (such as your pictures, text, links) will show up here.

a)

Head

b)

Body

c)

Style

d)

Folder

e)

Non capisco la domanda per via dell'Inglese

18.

The following tag will show a bulleted list

a)

<ul>

b)

<ol>

c)

<li>

d)

<list>

e)

Non capisco la domanda per via dell'Inglese

19.

Which line of HTML code creates a scrolling text box that can display three rows of text that are each 30 characters long?

a)

<input type="textarea" name="comments" width="30" rows="3"/>

b)

<input type="text" name="comments" chars="30" rows="3"/>

c)

<text name="comments" width="30" rows="3">

d)

<textarea name="comments" cols="30" rows="3">

e)

Non capisco la domanda per via dell'Inglese

20.

Which attribute of the <form> element is used to specify the way that user-entered Web form data will be sent to the Web server?

a)

The get attribute

b)

The post attribute

c)

The method attribute

d)

The action attribute

e)

Non capisco la domanda per via dell'Inglese

21.

The ___________ element defines a drop-down list

a)

value>

b)

<input>

c)

<select>

d)

<form>

e)

Non capisco la domanda per via dell'Inglese

22.

Dato il form in figura, quale sarà la prima linea del messaggio di request dopo il submit?

a)

GET /action_page?firstname=Mickey&lastname=Mouse HTTP/1.1

b)

POST /action_page?firstname=Mickey&lastname=Mouse HTTP/1.1

c)

GET firstname=Mickey&lastname=Mouse HTTP/1.1

d)

POST /action_page?firstname=Mickey&lastname=Mouse

23.

Dove si trova e cosa indica la stringa "HTTP/1.1 404 Not Found"

a)

E' la seconda linea di un messaggio di richiesta ed indica che non trova il protocollo

b)

E' la prima linea di un messaggio di risposta HTTP ed indica che la risorsa richiesta non è sul server

c)

E' la prima linea di un messaggio di richiesta HTTP ed indica che la risorsa richiesta non è sul server

d)

E' la seconda linea di un messaggio di risposta HTTP ed indica che la risorsa richiesta non è sul server

24.

Cosa NON è Tomcat?

a)

Web container

b)

Servlet container

c)

Web server

d)

HTTP server

e)

Nessuna delle altre opzioni

25.

Indicare quale delle seguenti frasi su MVC è FALSA

a)

In MVC, il Controller è implementato da servlet e non può scrivere direttamente l'output nella response

b)

In MVC, la View è implementata da JSP e può occuparsi solo di creare la presentazione dei risultati

c)

In MVC, il Model è implementato con classi Java e si occupa di risolvere il problema in atto con eventuale gestione dei dati da un repository

d)

In MVC, il Controller invia i dati ad una jsp tramite un'operazione di dispatch, inserendo i Javabeans creati dal Model nella request

e)

Nessuna delle altre opzioni

26.

Cosa restituisce il metodo getHeaderNames()

a)

La lista dei nomi degli headers di un messaggio di richiesta

b)

La lista dei valori degli headers di un messaggio di richiesta

c)

La lista dei nomi e dei valori degli headers di un messaggio di richiesta

d)

La lista dei nomi e dei valori degli headers di un messaggio di risposta

27.

Una servlet deve estendere..

a)

la classe HTTPServlet

b)

la classe HTTPServletRequest

c)

la classe HTTPServletResponse

d)

la classe GenericServlet

28.

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

a)

doGet()

b)

doPost()

c)

close()

d)

init()

e)

destroy()

29.
JSP significa...
a)
Java Server Plus
b)
Java Server Pages
c)
Java Server Platform 
d)
Java Standard Platform
30.

In JSP page directive which attribute defines the MIME(Multipurpose Internet Mail Extension) type of the HTTP response?

a)

import

b)

contentType

c)

extends

d)

info

31.

Never end an expression with semicolon inside Expression Tag?

a)

True

b)

False

32.

Which implicit object of JSP is equivalent to this variable of Java programming language?

a)

page

b)

pageContext

c)

config

d)

application

33.

Which implicit object is only available to a JSP page which is designated as error pages?

a)

application

b)

Throwable

c)

runnable

d)

exception

34.

_________ is responsible for managing execution of servlet

a)

Web Container

b)

Servlet Context

c)

JVM

d)

Server

35.

Which method is called only once in Servlet life cycle ?

a)

service()

b)

initialize()

c)

init()

d)

all of the above

36.

Which of these classes define the getWriter() method that returns an object of type PrintWriter ? Select the one correct answer. ?

a)

HttpServletRequest

b)

HttpServletResponse

c)

ServletConfig

d)

ServletContext

37.

When the Web Container initializes a servlet, it creates a ___________ object for the servlet ?

a)

ServletConfig

b)

ServletInit

c)

ServletContext

d)

None of the above

38.

If the client has disabled cookie in the browser, which session management mechanism could the web container employ ?

a)

Session Management using Cookies

b)

Session Management using URL rewriting

c)

Either Cookies or URL rewriting

d)

Cookies and URL rewriting must be used together

39.

Cookies are stored on _______ side.

a)

Client

b)

Server

c)

database

d)

none

40.

Which method is used to delete a session?

a)

invalidateSession()

b)

invalidate()

c)

deleteSession()

d)

delete()