Programming in Java

Descrição

SecondYear Second Year Quiz sobre Programming in Java, criado por Faheem Ahmed em 26-03-2018.
Faheem Ahmed
Quiz por Faheem Ahmed, atualizado more than 1 year ago
Faheem Ahmed
Criado por Faheem Ahmed mais de 6 anos atrás
1595
0

Resumo de Recurso

Questão 1

Questão
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?
Responda
  • Finally
  • Abstract
  • Final
  • Synchronized
  • Volatile

Questão 2

Questão
AWT stands for
Responda
  • Advanced windowing tool kit
  • Abstract Windowing Term Kit
  • Abstract Windowing Tool Kit
  • Applet Window Tool Kit
  • Asynchronous windowing tool kit

Questão 3

Questão
Which operator is used for concatenation in java?
Responda
  • -
  • . (Dot)
  • *
  • %
  • +

Questão 4

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

Questão 5

Questão
In object-oriented programming, the process by which one object acquires the properties of another object is called
Responda
  • Encapsulation
  • Polymorphism
  • Overloading
  • Inheritance
  • Overriding

Questão 6

Questão
Java compiler javac translates Java source code into ………………………
Responda
  • Assembler language
  • Byte code
  • Bit code
  • Machine code
  • Platform dependent code

Questão 7

Questão
Which of the following statements about Java Threads is correct?
Responda
  • 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

Questão 8

Questão
The wrapping up of data and functions into a single unit is called
Responda
  • Encapsulation
  • Abstraction
  • Data Hiding
  • Polymorphism
  • Message passing

Questão 9

Questão
In Java, declaring a class abstract is useful
Responda
  • 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

Questão 10

Questão
Which of the following is a member of the java.lang package?
Responda
  • List
  • Queue
  • Math
  • Stack
  • Process

Questão 11

Questão
URL stands for
Responda
  • Universal reader locator
  • Universal reform loader
  • Uniform resource loader
  • Uniform resource locator
  • Uniform reader locator

Questão 12

Questão
What is the sequence of major events in the life of an applet?
Responda
  • init, start, stop, destroy
  • start, init , stop , destroy
  • init, start , destroy, stop
  • init, start, destroy
  • destroy, start, init, stop

Questão 13

Questão
What will be the result of the expression 13 & 25?
Responda
  • 38
  • 25
  • 9
  • 12
  • 21

Questão 14

Questão
What information may be obtained from a ResultSetMetaData object?
Responda
  • 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

Questão 15

Questão
Which is a special file that contains information about the files packaged in a JAR file?
Responda
  • Class file
  • Source file
  • Text file
  • Manifest file
  • Image file

Questão 16

Questão
Evaluate the Java expressions: int i=3, j=7, k=11; j + k % i
Responda
  • 9
  • 0
  • 7
  • 12
  • 10

Questão 17

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

Questão 18

Questão
Which is not a valid operator in Java?
Responda
  • <>
  • =>
  • <=
  • +=
  • !=

Questão 19

Questão
Which of the following is not an Applet method?
Responda
  • start()
  • init()
  • run()
  • stop()
  • destroy()

Questão 20

Questão
If ClassA extends ClassB, then
Responda
  • ClassA is a superclass
  • ClassB is a base class
  • ClassB is a subclass
  • ClassB is a derived class
  • ClassA is a base class

Questão 21

Questão
SSL stands for
Responda
  • Secure Server Layer 
  • Secure Socket Layer 
  • Server Socket Layer 
  • Session Service Layer 

Questão 22

Questão
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?
Responda
  • doGet 
  • doPost 
  • doHref 
  • servicePost 

Questão 23

Questão
Stub is a ____________ proxy for the remote object.
Responda
  • Server side 
  • Client side 
  • Both side 
  • none of the above 

Questão 24

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

Questão 25

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

Questão 26

Questão
Which of these are legal identifiers.
Responda
  • number_1
  • number_a
  • $1234
  • All of the above

Questão 27

Questão
Which of the following are keywords in Java.
Responda
  • implement
  • friend
  • NULL
  • synchronized

Questão 28

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

Questão 29

Questão
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
Responda
  • Method Invocating
  • Method Overriding
  • Method Labeling
  • Method Overloading

Questão 30

Questão
Is this True or False. In Java an abstract class cannot be sub-classed.
Responda
  • True
  • False

Questão 31

Questão
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.
Responda
  • "xa"
  • "am"
  • "xm"
  • "xamp"

Questão 32

Questão
What is the result of evaluating the expression 14 ^ 23. Select the one correct answer.
Responda
  • 23
  • 24
  • 25
  • 26

Questão 33

Questão
Which of the following is not a return type?
Responda
  • boolean
  • void
  • public
  • Button

Questão 34

Questão
Which operator is used to perform bitwise exclusive or.
Responda
  • &
  • ^
  • |
  • !

Questão 35

Questão
If result = 2 + 3 * 5, what is the value and type of result variable?
Responda
  • 17, byte
  • 25, byte
  • 17, int
  • 25, int

Questão 36

Questão
All the wrapper classes (Integer, Boolean, Float, Short, Long, Double and Character) in java
Responda
  • are final
  • are private
  • are serializable
  • are immutatable

Questão 37

Questão
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); } }
Responda
  • 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.

Questão 38

Questão
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
Responda
  • a,d,f
  • a,e,f
  • d,e,f
  • d,a,e

Questão 39

Questão
When we go for thread synchronization?
Responda
  • 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

Questão 40

Questão
Which statement is true? public void test(int x) { int odd = 1; if(odd) { System.out.println("odd"); } else { System.out.println("even"); } }
Responda
  • "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.

Questão 41

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

Questão 42

Questão
Which of the following statements is false as far as different type of statements is concern in JDBC?
Responda
  • Regular Statement
  • Interim Statement
  • Callable Statement
  • Prepared Statement

Questão 43

Questão
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.
Responda
  • 1,2,3,4
  • 1,3,4,2
  • 2,1,3,4
  • 4,1,2,3

Questão 44

Questão
Which one not a JDBC interface?
Responda
  • Connection
  • Statement
  • DriverManager
  • ResultSet

Questão 45

Questão
Which one is a correct MySql Driver class name?
Responda
  • com.mysql.jdbc.driver.Driver
  • com.jdbc.mysql.Driver
  • com.mysql.jdbc.Driver
  • none of these

Questão 46

Questão
Which one correct JDBC statements?
Responda
  • Statement
  • PreparedStatement
  • CallableStatement
  • all of above

Questão 47

Questão
Where the stored procedures reside?
Responda
  • In side server memory
  • In side cache
  • In side database
  • In side browser

Questão 48

Questão
By default cursor pointing to-
Responda
  • Column Header
  • First Record
  • Last Record
  • Middle Record

Questão 49

Questão
By default "auto commit" option is -
Responda
  • true
  • false

Questão 50

Questão
We can get the column names using?
Responda
  • ResultSetColumnData
  • ResultSetMetaData
  • ResultSetHeaderData
  • ResultSetTableData

Questão 51

Questão
SELECT, INSERT, DELETE, UPDATE, COMMIT and ROLLBACK comes under ?
Responda
  • DML
  • DDL
  • DCL

Semelhante

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