Posts

Showing posts with the label Java

MCQ Questions on Fundamental of Java set-16

1) Java programs are ........ independent. A. platform B. procedural C. high level D. Secure 2) Methods having same name, same type signature are called ....... methods. A. overriding B. overloading C. overwriting D. over reading 3) When several tasks are handled by a single CPU, it is called ......... A. multitasking B. task C. simultaneous D. taker 4) A Java program must contain a ....... method. A. user defined B. main C. local D. return 5) Package statement helps to create many classes to have ........ name. A. differ B. vanity C. same D. punch 6) Threads can be created by extending .......... class. A. new B. operator C. thread D. super thread 7) ........... operator is used to create an array. A. new B. public C. key D. main 8) A method without the body is called ......... method. A. view B. class C. abstract D. user defined 9) Threads can be created by implementing ......... interface. A. new B. create C. main D. runnable 10) An instance of a class is ........ A. method B. init...

Interview Questions on Core Java Language set-3

1) The CODE value in an ......... tag must name a class file that is in the same directory as the calling HTML page. A. (applet) B. >applet< C. <applet> D. <applet tag> 2) A class can be converted to a thread by implementing the interface .......... A. Thread B. Runnable C. Start D. Yield 3) Which of the following classes are not available in the java.lang package? A. Stack B. Object C. Math D. String 4) State True or False for the following statements. i) Reader class has a method that can read and return floats and doubles ii) It is possible to use the File class to list the contents of the current of the working directory A. i-True, ii-False B. i-False, ii-True C. i-True, ii-True D. i-False, ii-False 5) The setBackground() method is part of the following class in JAVA.awt package. A. Component B. Graphics C. Applet D. Container 6) Which method is used to set the text of a Label object? A. setText() B. setLabel() C. setTextLabel() D. setLabelText() 7) Which of the f...

Objective Questions on Core Java Language set-2

1) The methods wait() and notify() are defined in A. java.lang.String B. java.lang.Runnable C. java.lang.Object D. java.lang.Thread 2) The data or variables, defined within a class are called ..... variables. A. object B. class C. instance D. schema 3) When we implement the Runnable interface, we must define the method. A. start() B. init() C. run() D. resume() 4) ........ class must give a concrete method. A. abstract B. constructor C. least D. program 5) Which exception is thrown by the read() method of input stream class? A. Exception B. FileNotFoundException C. ReadException D. IOException 6) When a method calls itself, it is called ...... A. recursion B. distance C. display D. problem 7) Which of the following statements are true? i) An abstract class may not have any final methods. ii) A final class may not have any abstract methods iii) An inner class may be declared with any accessibility keyword iv) Transient variable must be static A. i and ii B. ii and iii C. iii and iv D. A...

Interview Questions on Overview of Java set-15

1) Object is an ........ of class. A. instance B. implement C. inheritance D. invoke 2) ....... is the wrapper class. A. Random B. Byte C. Vector D. String 3) Class is a ........ entity. A. logical B. Physical C. up normal D. collection of 4) Which of the following denotes a javadoc comment? A. //# B. /* C. /** D. //** 5) Object is a ........ entity. A. normal B. physical C. logical D. normal 6) One interface can inherit another by use of the keyword ........ A. public B. extends C. method name D. class name 7) ......... must be the first non comment statement in the file A. package B. class C. object D. declaration 8) In java thread to thread communication is called .... A. passing B. sending C. messaging D. calling 9) Every method of a ........... is implicitly final. A. static class B. dynamic class C. final class D. abstract class 10) The string is defined in ......... name space. A. java.Lang B. java.String C. java.Char D. java.Awt 11) A ......... object cannot be modified after i...

Solved MCQ on Fundamental of Java Language set-14

1) Which of the following statement is/are true? i) The name of a java program file must match the name of the class with the extension .java ii) Two methods cannot have the same name in java A. i- only B. ii- only C. Both i and ii D. None of the above 2) Which of the following represent(s) of a hexadecimal number? A. 570 B. (hex)5 C. 0X9F D. 0X5 3) ........ can appear only where in the body of a java method. A. definition B. declaration C. determine D. package 4) State whether the following statement are True or False? i) The modulus operator(%) can be used only with integer operands ii) Declarations can appear anywhere in the body of a java method A. i-True, ii-False B. i-False, ii-True C. i-True, ii-True D. i-False, ii-False 5) Which of the following will produce a value of 22 if x=22.9? A. ceil(x) B. round(x) C. rint(x) D. abs(x) 6) ........ is passed to a method by use of call by reference. A. Variables B. Objects C. Methods D. Operators 7) Using the keyboard interface you can ful...

MCQ on Core Java with Answers set-1

1. Which exception is thrown by the read( ) method of input stream class? A) Exception B) ClassNotFoundException C) read Exception D) IOException 2. What garbage collection in the context of java? A) The operating system periodically deletes all of the java files available on the system. B) Any package imported in a program and not used in automatically deleted. C) When all references to an object are gone, the memory used by the object is automatically reclaimed. D) The JVM checks the output of any Java program and deletes anything that doesn't make sense. 3. In order for a source code file, containing the public class test, to successfully compile, which of the following must be true? A) It must have a package statement B) It must be named test.java C) It must import java.lang D) It must declare a public class named test. 4. Which of the following are true about the Error and Exception classes? A) Both classes extend throwable B) The error class is final and exception class is no...

MCQ on Java Programming Language Fundamental set-12

1. A java program is first ................ and ................... A) executed, run B) compiled, run C) run, compiled D) interpreted, compiled 2. Byte code is also a ........... A) machine code B) bit code C) cryptographic code D) none 3. A private class is accessible from inside a ................. A) package B) class C) method D) none 4. Consider the statement "x=(a>b)?a:b", then the value of x is 19, if a=19 and b=12 A) true B) not supported C) false D) none of the above 5. Adapter classes are used for ............... A) code redundancy B) code reduction C) code organization D) none 6. ..................... inheritance is enable by interface in java. A) min level B) multiple C) low level D) none 7. .................... is generated if a button is clicked in AWT. A) ItemEvent B) WindowEvent C) ActionEvent D) MouseEvent 8. Using which keyword we can access value of the instance and class variables of that class inside the method of that class itself. A) super B) final C)...

MCQ on Java Programming With Answers set-11

1. If m and n are int type variables, what will be the result of the expression m%n when m=-14 and n=-3? A) 4 B) 2 C) -2 D) -4 2. Consider the following code if(number>=0) if(number>0) system.out.println("Number is positive"); else system.out.println("Number is negative"); What will be the output if number is equal to 0? A) Number is negative B) Number is positive C) Both A and B D) None of the above 3. Consider the following code: char c='a'; switch (c) { case 'a'; system.out.println("A"); case 'b'; system.out.println("B"); default; system.out.println("C"); } For this code, which of the following statement is true? A) Output will be A B) Output will be A followed by B C) Output will be A, followed by B, and then followed by C D) Code is illegal and therefore will not compile 4. Consider the following class definition. class Student extends String { } What happens wh...

JDBC MCQ Interview Questions with Answers set-2

Image
1. A Java program cannot directly communicate with an ODBC driver because ....... ODBC Administrator (Photo credit: Wikipedia ) A) ODBC written in C language B) ODBC written in C# language C) ODBC written in C++ language D) ODBC written in Basic language 2.The JDBC-ODBC Bridge driver translates the JDBC API to the ODBC API and used with ....... A) JDBC drivers B) ODBC drivers C) Both A and B D) None of the above 3. The ............................. package contains classes that help in connecting to a database, sending SQL statements to the database, and processing the query results. A) connection.sql B) db.sql C) pkg.sql D) java.sql 4. The ................................ method executes a simple query and returns a single Result Set object. A) executeUpdate() B) executeQuery() C) execute() D) noexecute() 5. The ......................... method executes an SQL statement that may return multiple results. A) executeUpdate() B) executeQuery() C) execute() D) noexecute() 6. The ............

Java MCQ Interview Questions With Answers set-10

Image
1. Java was developed by the company A) Sun Micro systems Sun Micro systems Image CrunchBase B) Microsoft C) Micro tech D) IBM 2. What is the file extension of compiled java program? A) .class B) .java C) .css D) .html 3. .................. keyword is used to invoke the current object. A) New B) That C) This D) Me 4. Which of the function is used to convert string to Number in java program? A) to Number() B) conString() C) valueOf() D) toString() 5. What are the part in executing a Java program and their purposes? A) Java Compiler B) Java Interpreter C) Java Pre-processor D) Directive Pre-processor 6. Method overloading is one of the way that Java supports ............ A) encapsulation B) class C) inheritence D) polymorphism 7. Java support RMI. What does this RMI stands for? A) Random Memory Interface B) Remote Method Invocation C) Random Method Invocation D) Remote Memory Interface 8. Which of the following represent legal flow control statements? A) break; B) break(); C) continue(in...

Solved MCQ of JDBC and JSP set-1

Image
English: JDBC type 3 driver (Network Protocol driver) (Photo credit: Wikipedia ) 1. What is JDBC ? A) java compiler B) Java API C) Java interpreter D) Both A and B 2. JDBC is a ..................... interface, which means that it is used to invoke SQL commands directly A) low-level B) middle-level C) higher-level D) user 3. ODBC is not appropriate for direct use from java because it uses a .............. A) C interface B) C# interface C) java interface D) Both A and C 4. Java Soft provides ................. JDBC product components as part of the java Developer's Kit (JDK) A) three B) two C) four D) single 5. Kind of driver converts JDBC calls on the client API for Oracle, Sybase , Informix, DB2, or other DBMS is known as A) JDBC-Net pure Java driver B) JDBC-ODBC Bridge plus ODBC driver C) Native-API partly-Java driver D) Both A and B 6. JSP stands for .......................... A) Java server Pages B) Java server Programming C) Java Server Process D) Java Socket Programming 7....

Solved MCQ of Java Beans set-1

1. Java Servlets are efficient and powerful solution for creating ....................... for the web. A) dynamic content B) static content C) hardware D) both and b 2. Filters were officially introduced in the servlet ........................ specification. A) 2.1 B) 2.3 C) 2.2 D) 2.4 3. ..................... is the first phase of the servlet life cycle. A) Initialization B) Service C) Destruction D) Both a and b 4. The service phase of the servlet life cycle represents all interactions with requests until the servlet is ...................... A) created B) running C) initiated D) destroyed 5. GET methods are great for sending .................... amounts of information that you do not mind having visible in a URL. A) negligible B) huge C) small D) both and b 6. Several vendors are adding ...................... to their existing database ................. A) JDOBC, middle-ware products B) JDBC drivers , upper-ware products C) middle-ware products, JDOBC drivers D) JDBC drivers, middl...

Java Multiple Choice Questions With Answers set-8

1. Using which keyword we can access value of the instance variables and class variables of that class inside the method of that class itself. A) super B) final C) this D) either super or this 2. If a variable is declared final, it must include ...................... value. A) integer B) no C) initial D) float 3. State true or false. i) Jpanel is a class included in awt package. ii) Anonymous classes are mostly used for event handling. iii) Names of anonymous classes must be unique iv) JOptionPane is an inner class A) i-false, ii-false, iii-true, iv-true B) i-true, ii-false, iii-true, iv-false C) i-false, ii-true, iii-false, iv-false D) i-true, ii-false, iii-false, iv-true 4. In java, string is a ............. A) primitive data type B) abstract data type C) combination of boolean D) None of the above 5. Methods can be overloaded with a difference only in the type of the return value .. A) Not supported B) False C) True D) None of the above 6. Each method in a java class must have a u...

MCQ of Java With Answer set-7

1. The .................. and .................... classes are abstract classes that support reading and writing of byte streams. A) reader, writer B) inputstream, outputstream C) objectinputstream, objectoutputstream D) none 2. What is the error in the following code?      class Test      {          abstract void display( );      } A) No error B) Method display( ) should be declared as static C) Test class should be declared as abstract D) Test class should be declared as public 3. A package is a collection of A) classes B) interfaces C) editing tools D) classes and interfaces 4. Which of the following methods belong to the string class? A) length( ) B) compare To ( ) C) equals ( ) D) All of them 5. What will be the output of the following code?     byte x=64, y;     y= (byte) (x<<2);     System.out.println(y); A) 0 B) 1 C) 2 D) 64 6. If m and n are int type variables, what will be...

Java Multiple Choice Questions With Answers set-6

1. JSP embeds in ................ in ...................... A) Servlet, HTML B) HTML, Java C) HTML, Servlet D) Java, HTML 2. The class at the top of exception class hierarchy is .......................... A) ArithmeticException B) Throwable C) Class D) Exception 3. In a java program, package declaration .................... import statements. A) must precede B) must succeed C) may precede or succeed D) none 4. The class string belongs to ................... package. A) java.awt B) java.lang C) java.applet D) java.string 5. ............... package is used by compiler itself. So it does not need to be imported for use. A) java.math B) java.awt C) java.applet D) java.lang 6. State true or false for the following statements in Java. i) Java beans slow down software development process. ii) Java Servlets do not have built in multithreading feature. A) i-false, ii-false B) i-false, ii-true C) i-true, ii-false D) i-true, ii-true 7. State whether true or false. i) init( ) of servlet is called ...