Quiz
Programming in Java
Este quiz tem tempo limite, por isso abre no player de sempre.
Perguntas do quiz (51)
1What modifier is to be used if you wish to declare that you want to no longer allow subclasses to override your variables or methods?
- AFinally
- BAbstract
- CFinal
- DSynchronized
- EVolatile
2AWT stands for
- AAdvanced windowing tool kit
- BAbstract Windowing Term Kit
- CAbstract Windowing Tool Kit
- DApplet Window Tool Kit
- EAsynchronous windowing tool kit
3Which operator is used for concatenation in java?
- A-
- B. (Dot)
- C*
- D%
- E+
4What is the type and value of the following expression?
-4 + 1/2 + 2*-3 + 5.0- Aint -5
- Bdouble -4.5
- Cint -4
- Ddouble -5.0
5In object-oriented programming, the process by which one object acquires the properties of another object is called
- AEncapsulation
- BPolymorphism
- COverloading
- DInheritance
- EOverriding
6Java compiler javac translates Java source code into ………………………
- AAssembler language
- BByte code
- CBit code
- DMachine code
- EPlatform dependent code
7Which of the following statements about Java Threads is correct?
- AJava threads don’t allow parts of a program to be executed in parallel
- BJava is a single-threaded language
- CJava’s garbage collector runs as a high priority thread
- DReady, running and sleeping are three states that a thread can be in during its life cycle
- EEvery java application is not multithreaded
8The wrapping up of data and functions into a single unit is called
- AEncapsulation
- BAbstraction
- CData Hiding
- DPolymorphism
- EMessage passing
9In Java, declaring a class abstract is useful
- ATo prevent developers from further extending the class
- BWhen it doesn't make sense to have objects of that class
- CWhen default implementations of some methods are not desirable
- DTo force developers to extend the class not to use its capabilities
- EWhen it makes sense to have objects of that class
10Which of the following is a member of the java.lang package?
- AList
- BQueue
- CMath
- DStack
- EProcess
11URL stands for
- AUniversal reader locator
- BUniversal reform loader
- CUniform resource loader
- DUniform resource locator
- EUniform reader locator
12What is the sequence of major events in the life of an applet?
- Ainit, start, stop, destroy
- Bstart, init , stop , destroy
- Cinit, start , destroy, stop
- Dinit, start, destroy
- Edestroy, start, init, stop
13What will be the result of the expression 13 & 25?
- A38
- B25
- C9
- D12
- E21
14What information may be obtained from a ResultSetMetaData object?
- ADatabase URL and product name
- BJDBC driver name and version
- CNumber of columns in the result set
- DNumber of rows in the result set
- ENumber of tables in the database
15Which is a special file that contains information about the files packaged in a JAR file?
- AClass file
- BSource file
- CText file
- DManifest file
- EImage file
16Evaluate the Java expressions:
int i=3, j=7, k=11;
j + k % i- A9
- B0
- C7
- D12
- E10
17Which of the following provides the naming services for the server to register the object and for the client to locate the object?
- AServer object interface
- BServer implementation
- CRMI Registry
- DServer stub
- EServer Skeleton
18Which is not a valid operator in Java?
- A<>
- B=>
- C<=
- D+=
- E!=
19Which of the following is not an Applet method?
- Astart()
- Binit()
- Crun()
- Dstop()
- Edestroy()
20If ClassA extends ClassB, then
- AClassA is a superclass
- BClassB is a base class
- CClassB is a subclass
- DClassB is a derived class
- EClassA is a base class
21SSL stands for
- ASecure Server Layer
- BSecure Socket Layer
- CServer Socket Layer
- DSession Service Layer
22Consider the following HTML page code:
< html > < body >
< a href='/servlet/HelloServlet' >POST< /a >
< /body >< /html >
Which method of HelloServIet will be invoked when the hyperlink is clicked?- AdoGet
- BdoPost
- CdoHref
- DservicePost
23Stub is a ____________ proxy for the remote object.
- AServer side
- BClient side
- CBoth side
- Dnone of the above
24What is the Output:
String s1 = new String("Test");
String s2 = new String("Test");
if (s1==s2)
System.out.println("Same");
if (s1.equals(s2))
System.out.println("Equals");- ASame
Equals - BEquals
- CSame
- DThe code compiles, but nothing is displayed upon execution.
- EThe code fails to compile
- ASame
25Which declaration of the main method below would allow a class to be started as a standalone program.
- Apublic static int main(char args[])
- Bpublic static void main(String args[])
- Cpublic static void main(string args[])
- Dpublic static void main(String args)
26Which of these are legal identifiers.
- Anumber_1
- Bnumber_a
- C$1234
- DAll of the above
27Which of the following are keywords in Java.
- Aimplement
- Bfriend
- CNULL
- Dsynchronized
28Given a one dimensional array arr, what is the correct way of getting the number of elements in arr.
- Aarr.length
- Barr.length - 1
- Carr.size
- Darr.length()
29A class can have many methods with the same name as long as the number of parameters or type of parameters is different. This OOP concept is known as
- AMethod Invocating
- BMethod Overriding
- CMethod Labeling
- DMethod Overloading
30Is this True or False. In Java an abstract class cannot be sub-classed.
- ATrue
- BFalse
31What is returned when the method substring(2, 4) is invoked on the string "example"? Include the answer in quotes as the result is of type String.
- A"xa"
- B"am"
- C"xm"
- D"xamp"
32What is the result of evaluating the expression 14 ^ 23. Select the one correct answer.
- A23
- B24
- C25
- D26
33Which of the following is not a return type?
- Aboolean
- Bvoid
- Cpublic
- DButton
34Which operator is used to perform bitwise exclusive or.
- A&
- B^
- C|
- D!
35If result = 2 + 3 * 5, what is the value and type of result variable?
- A17, byte
- B25, byte
- C17, int
- D25, int
36All the wrapper classes (Integer, Boolean, Float, Short, Long, Double and Character) in java
- Aare final
- Bare private
- Care serializable
- Dare immutatable
37What is the result of compiling and running this program? Select the one correct answer.
public class test
{ public static void main(String args[])
{ int i, j;
int k = 0;
j = 2;
k = j = i = 1;
System.out.println(k);
}
}- AThe program does not compile as k is being read without being initialized.
- BThe program does not compile because of the statement k = j = i = 1;
- CThe program compiles and runs printing 1.
- DThe program compiles and runs printing 2.
38A program needs to store the name, salary, and age of employees in years. Which of the following data types should be used to create the Employee class. Select the three correct answers.
a. char
b. boolean
c. Boolean
d. String
e. int
f. double- Aa,d,f
- Ba,e,f
- Cd,e,f
- Dd,a,e
39When we go for thread synchronization?
- Ato remove the lock on the thread
- Bwhen there is a single thread
- Cto make a thread in sleep mode
- Dwhen we want to prevent any other multiple thread to act an same object
40Which statement is true?
public void test(int x)
{ int odd = 1;
if(odd)
{ System.out.println("odd"); }
else
{ System.out.println("even"); }
}- A"odd" will always be output.
- B"even" will always be output.
- CCompilation fails.
- D"odd" will be output for odd values of x, and "even" for even values.
41Which code determines the int value data closer to, but not greater than, a double value b?
- Aint data = (int) Math.floor(b);
- Bint data = (int) Math.abs(b);
- Cint data = (int) Math.ceil(b);
- Dint data = (int) Math.min(b);
42Which of the following statements is false as far as different type of statements is concern in JDBC?
- ARegular Statement
- BInterim Statement
- CCallable Statement
- DPrepared Statement
43Which of the following describes the correct sequence of the steps involved in making a connection with a database.
1. Loading the driver
2. Process the results.
3. Making the connection with the database.
4. Executing the SQL statements.- A1,2,3,4
- B1,3,4,2
- C2,1,3,4
- D4,1,2,3
44Which one not a JDBC interface?
- AConnection
- BStatement
- CDriverManager
- DResultSet
45Which one is a correct MySql Driver class name?
- Acom.mysql.jdbc.driver.Driver
- Bcom.jdbc.mysql.Driver
- Ccom.mysql.jdbc.Driver
- Dnone of these
46Which one correct JDBC statements?
- AStatement
- BPreparedStatement
- CCallableStatement
- Dall of above
47Where the stored procedures reside?
- AIn side server memory
- BIn side cache
- CIn side database
- DIn side browser
48By default cursor pointing to-
- AColumn Header
- BFirst Record
- CLast Record
- DMiddle Record
49By default "auto commit" option is -
- Atrue
- Bfalse
50We can get the column names using?
- AResultSetColumnData
- BResultSetMetaData
- CResultSetHeaderData
- DResultSetTableData
51SELECT, INSERT, DELETE, UPDATE, COMMIT and ROLLBACK comes under ?
- ADML
- BDDL
- CDCL
Informações
- Descrição
- SecondYear Second Year Quiz sobre Programming in Java, criado por Faheem Ahmed em 26-03-2018.
- Autor
- Faheem Ahmed
- Idioma
- English
- Visualizações
- 1.673
- Etiquetas
- Avaliação
- Ainda sem avaliações Avalie este quiz