Programming in Java

Beschreibung

SecondYear Second Year Quiz am Programming in Java, erstellt von Faheem Ahmed am 26/03/2018.
Faheem Ahmed
Quiz von Faheem Ahmed, aktualisiert more than 1 year ago
Faheem Ahmed
Erstellt von Faheem Ahmed vor mehr als 6 Jahre
1593
0

Zusammenfassung der Ressource

Frage 1

Frage
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?
Antworten
  • Finally
  • Abstract
  • Final
  • Synchronized
  • Volatile

Frage 2

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

Frage 3

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

Frage 4

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

Frage 5

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

Frage 6

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

Frage 7

Frage
Which of the following statements about Java Threads is correct?
Antworten
  • 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

Frage 8

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

Frage 9

Frage
In Java, declaring a class abstract is useful
Antworten
  • 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

Frage 10

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

Frage 11

Frage
URL stands for
Antworten
  • Universal reader locator
  • Universal reform loader
  • Uniform resource loader
  • Uniform resource locator
  • Uniform reader locator

Frage 12

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

Frage 13

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

Frage 14

Frage
What information may be obtained from a ResultSetMetaData object?
Antworten
  • 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

Frage 15

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

Frage 16

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

Frage 17

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

Frage 18

Frage
Which is not a valid operator in Java?
Antworten
  • <>
  • =>
  • <=
  • +=
  • !=

Frage 19

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

Frage 20

Frage
If ClassA extends ClassB, then
Antworten
  • ClassA is a superclass
  • ClassB is a base class
  • ClassB is a subclass
  • ClassB is a derived class
  • ClassA is a base class

Frage 21

Frage
SSL stands for
Antworten
  • Secure Server Layer 
  • Secure Socket Layer 
  • Server Socket Layer 
  • Session Service Layer 

Frage 22

Frage
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?
Antworten
  • doGet 
  • doPost 
  • doHref 
  • servicePost 

Frage 23

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

Frage 24

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

Frage 25

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

Frage 26

Frage
Which of these are legal identifiers.
Antworten
  • number_1
  • number_a
  • $1234
  • All of the above

Frage 27

Frage
Which of the following are keywords in Java.
Antworten
  • implement
  • friend
  • NULL
  • synchronized

Frage 28

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

Frage 29

Frage
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
Antworten
  • Method Invocating
  • Method Overriding
  • Method Labeling
  • Method Overloading

Frage 30

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

Frage 31

Frage
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.
Antworten
  • "xa"
  • "am"
  • "xm"
  • "xamp"

Frage 32

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

Frage 33

Frage
Which of the following is not a return type?
Antworten
  • boolean
  • void
  • public
  • Button

Frage 34

Frage
Which operator is used to perform bitwise exclusive or.
Antworten
  • &
  • ^
  • |
  • !

Frage 35

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

Frage 36

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

Frage 37

Frage
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); } }
Antworten
  • 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.

Frage 38

Frage
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
Antworten
  • a,d,f
  • a,e,f
  • d,e,f
  • d,a,e

Frage 39

Frage
When we go for thread synchronization?
Antworten
  • 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

Frage 40

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

Frage 41

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

Frage 42

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

Frage 43

Frage
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.
Antworten
  • 1,2,3,4
  • 1,3,4,2
  • 2,1,3,4
  • 4,1,2,3

Frage 44

Frage
Which one not a JDBC interface?
Antworten
  • Connection
  • Statement
  • DriverManager
  • ResultSet

Frage 45

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

Frage 46

Frage
Which one correct JDBC statements?
Antworten
  • Statement
  • PreparedStatement
  • CallableStatement
  • all of above

Frage 47

Frage
Where the stored procedures reside?
Antworten
  • In side server memory
  • In side cache
  • In side database
  • In side browser

Frage 48

Frage
By default cursor pointing to-
Antworten
  • Column Header
  • First Record
  • Last Record
  • Middle Record

Frage 49

Frage
By default "auto commit" option is -
Antworten
  • true
  • false

Frage 50

Frage
We can get the column names using?
Antworten
  • ResultSetColumnData
  • ResultSetMetaData
  • ResultSetHeaderData
  • ResultSetTableData

Frage 51

Frage
SELECT, INSERT, DELETE, UPDATE, COMMIT and ROLLBACK comes under ?
Antworten
  • DML
  • DDL
  • DCL
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

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