Programming in Java

Descripción

SecondYear Second Year Test sobre Programming in Java, creado por Faheem Ahmed el 26/03/2018.
Faheem Ahmed
Test por Faheem Ahmed, actualizado hace más de 1 año
Faheem Ahmed
Creado por Faheem Ahmed hace alrededor de 6 años
1589
0

Resumen del Recurso

Pregunta 1

Pregunta
What modifier is to be used if you wish to declare that you want to no longer allow subclasses to override your variables or methods?
Respuesta
  • Finally
  • Abstract
  • Final
  • Synchronized
  • Volatile

Pregunta 2

Pregunta
AWT stands for
Respuesta
  • Advanced windowing tool kit
  • Abstract Windowing Term Kit
  • Abstract Windowing Tool Kit
  • Applet Window Tool Kit
  • Asynchronous windowing tool kit

Pregunta 3

Pregunta
Which operator is used for concatenation in java?
Respuesta
  • -
  • . (Dot)
  • *
  • %
  • +

Pregunta 4

Pregunta
What is the type and value of the following expression? -4 + 1/2 + 2*-3 + 5.0
Respuesta
  • int -5
  • double -4.5
  • int -4
  • double -5.0

Pregunta 5

Pregunta
In object-oriented programming, the process by which one object acquires the properties of another object is called
Respuesta
  • Encapsulation
  • Polymorphism
  • Overloading
  • Inheritance
  • Overriding

Pregunta 6

Pregunta
Java compiler javac translates Java source code into ………………………
Respuesta
  • Assembler language
  • Byte code
  • Bit code
  • Machine code
  • Platform dependent code

Pregunta 7

Pregunta
Which of the following statements about Java Threads is correct?
Respuesta
  • Java threads don’t allow parts of a program to be executed in parallel
  • Java is a single-threaded language
  • Java’s garbage collector runs as a high priority thread
  • Ready, running and sleeping are three states that a thread can be in during its life cycle
  • Every java application is not multithreaded

Pregunta 8

Pregunta
The wrapping up of data and functions into a single unit is called
Respuesta
  • Encapsulation
  • Abstraction
  • Data Hiding
  • Polymorphism
  • Message passing

Pregunta 9

Pregunta
In Java, declaring a class abstract is useful
Respuesta
  • To prevent developers from further extending the class
  • When it doesn't make sense to have objects of that class
  • When default implementations of some methods are not desirable
  • To force developers to extend the class not to use its capabilities
  • When it makes sense to have objects of that class

Pregunta 10

Pregunta
Which of the following is a member of the java.lang package?
Respuesta
  • List
  • Queue
  • Math
  • Stack
  • Process

Pregunta 11

Pregunta
URL stands for
Respuesta
  • Universal reader locator
  • Universal reform loader
  • Uniform resource loader
  • Uniform resource locator
  • Uniform reader locator

Pregunta 12

Pregunta
What is the sequence of major events in the life of an applet?
Respuesta
  • init, start, stop, destroy
  • start, init , stop , destroy
  • init, start , destroy, stop
  • init, start, destroy
  • destroy, start, init, stop

Pregunta 13

Pregunta
What will be the result of the expression 13 & 25?
Respuesta
  • 38
  • 25
  • 9
  • 12
  • 21

Pregunta 14

Pregunta
What information may be obtained from a ResultSetMetaData object?
Respuesta
  • Database URL and product name
  • JDBC driver name and version
  • Number of columns in the result set
  • Number of rows in the result set
  • Number of tables in the database

Pregunta 15

Pregunta
Which is a special file that contains information about the files packaged in a JAR file?
Respuesta
  • Class file
  • Source file
  • Text file
  • Manifest file
  • Image file

Pregunta 16

Pregunta
Evaluate the Java expressions: int i=3, j=7, k=11; j + k % i
Respuesta
  • 9
  • 0
  • 7
  • 12
  • 10

Pregunta 17

Pregunta
Which of the following provides the naming services for the server to register the object and for the client to locate the object?
Respuesta
  • Server object interface
  • Server implementation
  • RMI Registry
  • Server stub
  • Server Skeleton

Pregunta 18

Pregunta
Which is not a valid operator in Java?
Respuesta
  • <>
  • =>
  • <=
  • +=
  • !=

Pregunta 19

Pregunta
Which of the following is not an Applet method?
Respuesta
  • start()
  • init()
  • run()
  • stop()
  • destroy()

Pregunta 20

Pregunta
If ClassA extends ClassB, then
Respuesta
  • ClassA is a superclass
  • ClassB is a base class
  • ClassB is a subclass
  • ClassB is a derived class
  • ClassA is a base class

Pregunta 21

Pregunta
SSL stands for
Respuesta
  • Secure Server Layer 
  • Secure Socket Layer 
  • Server Socket Layer 
  • Session Service Layer 

Pregunta 22

Pregunta
Consider 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?
Respuesta
  • doGet 
  • doPost 
  • doHref 
  • servicePost 

Pregunta 23

Pregunta
Stub is a ____________ proxy for the remote object.
Respuesta
  • Server side 
  • Client side 
  • Both side 
  • none of the above 

Pregunta 24

Pregunta
What 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");
Respuesta
  • Same Equals
  • Equals
  • Same
  • The code compiles, but nothing is displayed upon execution.
  • The code fails to compile

Pregunta 25

Pregunta
Which declaration of the main method below would allow a class to be started as a standalone program.
Respuesta
  • public static int main(char args[])
  • public static void main(String args[])
  • public static void main(string args[])
  • public static void main(String args)

Pregunta 26

Pregunta
Which of these are legal identifiers.
Respuesta
  • number_1
  • number_a
  • $1234
  • All of the above

Pregunta 27

Pregunta
Which of the following are keywords in Java.
Respuesta
  • implement
  • friend
  • NULL
  • synchronized

Pregunta 28

Pregunta
Given a one dimensional array arr, what is the correct way of getting the number of elements in arr.
Respuesta
  • arr.length
  • arr.length - 1
  • arr.size
  • arr.length()

Pregunta 29

Pregunta
A 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
Respuesta
  • Method Invocating
  • Method Overriding
  • Method Labeling
  • Method Overloading

Pregunta 30

Pregunta
Is this True or False. In Java an abstract class cannot be sub-classed.
Respuesta
  • True
  • False

Pregunta 31

Pregunta
What 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.
Respuesta
  • "xa"
  • "am"
  • "xm"
  • "xamp"

Pregunta 32

Pregunta
What is the result of evaluating the expression 14 ^ 23. Select the one correct answer.
Respuesta
  • 23
  • 24
  • 25
  • 26

Pregunta 33

Pregunta
Which of the following is not a return type?
Respuesta
  • boolean
  • void
  • public
  • Button

Pregunta 34

Pregunta
Which operator is used to perform bitwise exclusive or.
Respuesta
  • &
  • ^
  • |
  • !

Pregunta 35

Pregunta
If result = 2 + 3 * 5, what is the value and type of result variable?
Respuesta
  • 17, byte
  • 25, byte
  • 17, int
  • 25, int

Pregunta 36

Pregunta
All the wrapper classes (Integer, Boolean, Float, Short, Long, Double and Character) in java
Respuesta
  • are final
  • are private
  • are serializable
  • are immutatable

Pregunta 37

Pregunta
What 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); } }
Respuesta
  • The program does not compile as k is being read without being initialized.
  • The program does not compile because of the statement k = j = i = 1;
  • The program compiles and runs printing 1.
  • The program compiles and runs printing 2.

Pregunta 38

Pregunta
A 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
Respuesta
  • a,d,f
  • a,e,f
  • d,e,f
  • d,a,e

Pregunta 39

Pregunta
When we go for thread synchronization?
Respuesta
  • to remove the lock on the thread
  • when there is a single thread
  • to make a thread in sleep mode
  • when we want to prevent any other multiple thread to act an same object

Pregunta 40

Pregunta
Which statement is true? public void test(int x) { int odd = 1; if(odd) { System.out.println("odd"); } else { System.out.println("even"); } }
Respuesta
  • "odd" will always be output.
  • "even" will always be output.
  • Compilation fails.
  • "odd" will be output for odd values of x, and "even" for even values.

Pregunta 41

Pregunta
Which code determines the int value data closer to, but not greater than, a double value b?
Respuesta
  • int data = (int) Math.floor(b);
  • int data = (int) Math.abs(b);
  • int data = (int) Math.ceil(b);
  • int data = (int) Math.min(b);

Pregunta 42

Pregunta
Which of the following statements is false as far as different type of statements is concern in JDBC?
Respuesta
  • Regular Statement
  • Interim Statement
  • Callable Statement
  • Prepared Statement

Pregunta 43

Pregunta
Which 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.
Respuesta
  • 1,2,3,4
  • 1,3,4,2
  • 2,1,3,4
  • 4,1,2,3

Pregunta 44

Pregunta
Which one not a JDBC interface?
Respuesta
  • Connection
  • Statement
  • DriverManager
  • ResultSet

Pregunta 45

Pregunta
Which one is a correct MySql Driver class name?
Respuesta
  • com.mysql.jdbc.driver.Driver
  • com.jdbc.mysql.Driver
  • com.mysql.jdbc.Driver
  • none of these

Pregunta 46

Pregunta
Which one correct JDBC statements?
Respuesta
  • Statement
  • PreparedStatement
  • CallableStatement
  • all of above

Pregunta 47

Pregunta
Where the stored procedures reside?
Respuesta
  • In side server memory
  • In side cache
  • In side database
  • In side browser

Pregunta 48

Pregunta
By default cursor pointing to-
Respuesta
  • Column Header
  • First Record
  • Last Record
  • Middle Record

Pregunta 49

Pregunta
By default "auto commit" option is -
Respuesta
  • true
  • false

Pregunta 50

Pregunta
We can get the column names using?
Respuesta
  • ResultSetColumnData
  • ResultSetMetaData
  • ResultSetHeaderData
  • ResultSetTableData

Pregunta 51

Pregunta
SELECT, INSERT, DELETE, UPDATE, COMMIT and ROLLBACK comes under ?
Respuesta
  • DML
  • DDL
  • DCL
Mostrar resumen completo Ocultar resumen completo

Similar

Useful String Methods
Shannon Anderson-Rush
HTTPS explained with Carrier Pigeons
Shannon Anderson-Rush
Historical Development of Computer Languages
Shannon Anderson-Rush
Java Week 5 Object Oriented Programming
Troy Bowlin
Flvs foundations of programming dba 2
mariaha vassar
Programming Review
Shannon Anderson-Rush
COP 1000 - Intro to Computer Programming (Final Exam)
Taylor Walker
Python Quiz
karljmurphy
computer systems and programming quiz
Molly Batch
Think Python
tsilvo2001