01. Which valid Java code implements this UML class diagram?
a) class StringMunger {
str1 : String = "Hello";
str2 : String = "World";
space : char = ' ';
str3 : String = str1 + space + str2;
}
b) class StringMunger {
String str1 = "Hello";
String str2 = "World";
char space = ' ';
String str3 = str1 + space + str2;
}
c) class StringMunger {
str1 : String = ['H', 'e', 'l', 'l', 'o' ];
str2 : String = ['W', 'o', 'r', 'l', 'd' ];
space : char = ' ';
str3 : String = str1 | space | str2;
}
d) class StringMunger {
String str1 = ['H', 'e', 'l', 'l', 'o' ];
String str2 = ['W', 'o', 'r', 'l', 'd' ];
char space = ' ';
String str3 = str1 | space | str2;
}
02. Which correctly declares a class Test in package com.example?
a) package com.example {
class Test {
// some code here
}
b) package com.example;
public class Test {
// some code here
}
c) public class com.example.Test {
// some code here
}
d) import com.example;
public class Test {
// some code here
}
03. Which two technologies are the primary components of the database tier?
a) SQL
b) HTTP
c) JDBC
d) RDBMS
e) Java
04. Which package contains APIs that are useful for distributed programming and communication?
a) java.awt
b) java.net
c) java.util
d) javax.swing
05. Which two are required for encapsulating a Java class?
a) Attributes must be marked with public.
b) Attributes must be marked with private.
c) Internal methods must be marked with public.
d) Internal methods must be marked with private.
e) Attributes must be given private accessor and mutator methods.
06. Which is true?
a) You must use JDBC to connect an RDBMS to a Java application
b) JDBC is designed to provide a bridge between servlets and EJB technology.
c) Classes in the JDBC API include implementations of JDBC drivers.
d) The JDBC API is located within the java.sql and javax.sql packages.
07. Which two types of applications are appropriate for J2ME?
a) games
b) word processing
c) remote data collection
d) number processing
08. Which describes the role of servlet developer?
a) a Java programmer who creates programs that execute on cell phones
b) a Java programmer who creates classes that respond to HTTP requests
c) a web designer who generates dynamic web pages to create user interfaces
d) a Java programmer who creates components that represent data in a relational database
09. Which type of primitive can be assigned a new value within a conditional expression?
a) char
b) boolean
c) byte
d) int
e) short
10. Which two are features of JNDI?
(Choose two.)
a) an interface to store and retrieve named Java objects of any type
b) an interface to search for objects using attributes
c) a defined common set of messaging concepts and programming strategies
d) connectivity to databases and other tabular data sources