0

web technology Online Quiz - 120

Description: web technology Online Quiz - 120
Number of Questions: 20
Created by:
Tags: web technology
Attempted 0/20 Correct 0 Score 0
  1. The before() method will print 1 2

  2. The before() method will print 1 2 3

  3. The before() method will print three numbers, but the order cannot be determined

  4. The before() method will not compile

  5. The before() method will throw an exception at runtime


Correct Option: E

Given: interface Hungry { void munch(E x); } interface Carnivore extends Hungry {} interface Herbivore extends Hungry {} abstract class Plant {} class Grass extends Plant {} abstract class Animal {} class Sheep extends Animal implements Herbivore { public void munch(Sheep x) {} } class Wolf extends Animal implements Carnivore { public void munch(Sheep x) {} } Which of the following changes (taken separately) would allow this code to compile? (Choose all that apply.)

  1. Change the Carnivore interface to interface Carnivore extends Hungry {}

  2. Change the Herbivore interface to interface Herbivore extends Hungry {}

  3. Change the Sheep class to class Sheep extends Animal implements Herbivore { public void munch(Grass x) {} }

  4. Change the Sheep class to class Sheep extends Plant implements Carnivore { public void munch(Wolf x) {} }

  5. Change the Wolf class to class Wolf extends Animal implements Herbivore { public void munch(Grass x) {} }

  6. No changes are necessary


Correct Option: B

Which collection class(es) allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized? (Choose all that apply.)

  1. java.util.HashSet

  2. java.util.LinkedHashSet

  3. java.util.List

  4. java.util.ArrayList

  5. java.util.Vector

  6. java.util.PriorityQueue


Correct Option: D

Given: 3. import java.util.*; 4. class Business { } 5. class Hotel extends Business { } 6. class Inn extends Hotel { } 7. public class Travel { 8. ArrayList go() { 9. // insert code here 10. } 11. } Which, inserted independently at line 9, will compile? (Choose all that apply.)

  1. return new ArrayList();

  2. return new ArrayList();

  3. return new ArrayList();

  4. return new ArrayList();


Correct Option: B
  1. "X extends Y" is correct if and only if X is a class and Y is an interface

  2. "X extends Y" is correct if and only if X is an interface and Y is a class

  3. "X extends Y" is correct if X and Y are either both classes or both interfaces

  4. "X extends Y" is correct for all combinations of X and Y being classes and/or interfaces


Correct Option: C

Given: 3. public class Wind { 4. public static void main(String[] args) { 5. foreach: 6. for(int j=0; j<5; j++) { 7. for(int k=0; k< 3; k++) { 8. System.out.print(" " + j); 9. if(j==3 && k==1) break foreach; 10. if(j==0 || j==2) break; 11. } 12. } 13. } 14. } What is the result?

  1. 0 1 2 3

  2. 1 1 1 3 3

  3. 0 1 1 1 2 3 3

  4. 1 1 1 3 3 4 4 4

  5. 0 1 1 1 2 3 3 4 4 4

  6. Compilation fails


Correct Option: C

Given: 3. public class TestDays { 4. public enum Days { MON, TUE, WED }; 5. public static void main(String[] args) { 6. for(Days d : Days.values() ) 7. ; 8. Days [] d2 = Days.values(); 9. System.out.println(d2[2]); 10. } 11. } What is the result? (Choose all that apply.)

  1. TUE

  2. Wed

  3. The output is unpredictable

  4. Compilation fails due to an error on line 4

  5. Compilation fails due to an error on line 6

  6. Compilation fails due to an error on line 8


Correct Option: B

What is output to the web page on the second access to the same instance of the following JSP? (Choose one.) Chapter 6 Question 2

Chapter 6 Question 2

  1. 0

  2. 1

  3. 2

  4. 3

  5. 4

  6. Page does not translate.


Correct Option: D
  1. A rectangular box with the name of the class in the box

  2. A rectangular box with the name of the object, a : and the class name that the object belongs to

  3. A rectangular box with the class name prefixed by the word "class"

  4. A thin vertical line with key method calls shown as outward arrows

  5. A rectangular box with an inserted dashed box on the top right corner.


Correct Option: A

In the UML notation, an object can be represented by

  1. A comment or explanatory note associated with a class

  2. A rectangular box with the object name and the constraint "{object}" immediatly following it

  3. A rectangular box with the name of the object in the box.

  4. A rectangular box with the name of the object, a : and the class name that the object belongs to.

  5. A thin vertical line with key method calls shown as outward arrows .


Correct Option: D
  1. nesting of classes

  2. lines with a solid diamond at one end

  3. lines with a hollow diamond at one end

  4. lines with a triangular arrow at one end

  5. lines with a triangular arrow at both ends


Correct Option: D
  1. getSessionBehaviour()

  2. getApplicationId()

  3. getSecurityLevel()

  4. getServletName()


Correct Option: B

Which one is correct?

  1. Write name here

  2. Write name here

  3. Write name here

  4. Write name here


Correct Option: A

The file where the context root of the application is specified

  1. Web.xml

  2. application.xml

  3. ps.xml

  4. Actionconfig.xml


Correct Option: B

An sequence diagram is

  1. a time-line illustrating a typical sequence of calls between object function members

  2. a call tree illustrating all possible sequences of calls between class function members

  3. a time-line illustrating the changes in inheritance and instantiation relationships between classes and objects over time

  4. a tree illustrating inheritance and relationships between classes

  5. a directed acyclic graph illustrating inheritance and instantiation relationships between classes and objects


Correct Option: A
- Hide questions