MCQOPTIONS
Saved Bookmarks
This section includes 40 Mcqs, each offering curated multiple-choice questions to sharpen your Technology knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
X implements Y extends Z |
| A. | X can be class Y,Z are interfaces |
| B. | X is an interface Y,Z are classes |
| C. | X,Y are classes Z is an interface |
| D. | Complilation error |
| Answer» E. | |
| 2. |
X implements Y, Z_x005F_x000D_ Arguments:_x005F_x000D_ 1. X should be class2. Y, Z should be interfaces |
| A. | Only 1 is true |
| B. | Only 2 is true |
| C. | Both 1 and 2 are true |
| D. | None |
| Answer» D. None | |
| 3. |
Which of the following statements about inheritance is false? |
| A. | Inheritance allows you to minimize the amount of duplicate code in an application by sharing common code among several subclasses. |
| B. | A subclass inherits all the members (fields, methods, and nested classes) from its superclass. |
| C. | Through inheritance, a parent class is a more specialized form of the child class. |
| D. | Inheritance allows you to reuse the fields and methods of the super class without having to write them yourself. |
| Answer» D. Inheritance allows you to reuse the fields and methods of the super class without having to write them yourself. | |
| 4. |
Which of the following statements are equal for a variable declared in the interface ?_x005F_x000D_ 1. int X=102. public int X=103. public static final int X=10 |
| A. | Only 1 and 2 are equal |
| B. | Only 2 and 3 are equal |
| C. | All are unequal |
| D. | All are equal |
| Answer» E. | |
| 5. |
Which of these class have only one field 'TYPE' ? |
| A. | Run time |
| B. | Process |
| C. | Void |
| D. | System |
| Answer» D. System | |
| 6. |
Which of the following modifiers can be used with Local inner class? |
| A. | Final or Abstract |
| B. | Final or Transcient |
| C. | Abstract or Transcient |
| D. | Final or public |
| Answer» B. Final or Transcient | |
| 7. |
Which of the following method declarations are allowed inside interface? |
| A. | public void m1() |
| B. | private void m1() |
| C. | protected void m1() |
| D. | abstract public void m1() |
| Answer» E. | |
| 8. |
Which of the following is not the other name of attriibute? |
| A. | Data member |
| B. | Instance variable |
| C. | instance |
| D. | Data filed |
| Answer» D. Data filed | |
| 9. |
Which of the following is not used for commenting in java? |
| A. | // |
| B. | /* */ |
| C. | /** */ |
| D. | /** **/ |
| Answer» E. | |
| 10. |
Which of the following attribute can hold the JavaScript version? |
| A. | script |
| B. | version |
| C. | language |
| D. | none of the above |
| Answer» D. none of the above | |
| 11. |
Which of the following best describes JavaScript? |
| A. | a scripting language precompiled in the browser. |
| B. | an object-oriented scripting language |
| C. | a low-level programming language. |
| D. | a compiled scripting language. |
| Answer» C. a low-level programming language. | |
| 12. |
Which of the following are incorrect form of StringBuffer class constructor  ? |
| A. | StringBuffer(int size , String str) |
| B. | StringBuffer(int size) |
| C. | StringBuffer(String str) |
| D. | StringBuffer() |
| Answer» B. StringBuffer(int size) | |
| 13. |
Which of the following are valied? |
| A. | A class can extend any number of classes simulteneously |
| B. | A class can implement only one interface at a time |
| C. | A class can extend other class or can implement interface but not both simulteneously |
| D. | None of the above |
| Answer» E. | |
| 14. |
Which of the following are capabilities of functions in JavaScript? |
| A. | Accept parameters |
| B. | Return a value |
| C. | Accept parameters and Return a value |
| D. | None of the above |
| Answer» B. Return a value | |
| 15. |
Which method names follow the JavaBeans standard? |
| A. | addSize |
| B. | putDimensions |
| C. | getCust |
| D. | deleteRep |
| Answer» D. deleteRep | |
| 16. |
Which key word is to be used to tell the JVM to skip the variable while performing the serialization process of the object containing it? |
| A. | Transcient |
| B. | Volatile |
| C. | Static |
| D. | Final |
| Answer» B. Volatile | |
| 17. |
Which king class properly represents the relationship "King has a best friend who is a Soldier"? |
| A. | class King extends Soldier { } |
| B. | class King implements Soldier { } |
| C. | class King { private BestFriend Soldier; } |
| D. | class King { private Soldier bestFriend; } |
| Answer» E. | |
| 18. |
Which kind of inheritance is not supported directly through classes in java? |
| A. | Multilevel |
| B. | Multiple |
| C. | Single |
| D. | Hirarcheal |
| Answer» C. Single | |
| 19. |
Which among the following is a scope resolution operator? |
| A. | : |
| B. | :: |
| C. | :? |
| D. | None |
| Answer» C. :? | |
| 20. |
What is the output of this program ?_x005F_x000D_ class main_arguments {Â Â Â Â Â Â Â Â Â Â Â public static void main(String [ ] args) Â Â Â Â Â Â Â Â Â Â Â {Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â String [][] argument = new String[2][2];Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â int x;Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â argument[0] = args;Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â x = argument[0].length;Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â for (int y = 0; y < x; y++) Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â System.out.print(" " + argument[0][y]);Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â }Â Â Â Â Â Â Â } |
| A. | 1 1 |
| B. | 1 0 |
| C. | 1 0 3 |
| D. | 1 2 3 |
| Answer» E. | |
| 21. |
try { int x = Integer.parseInt("two"); }_x005F_x000D_ Which could be used to create an appropriate catch block? |
| A. | ClassCastException |
| B. | IllegalStateException |
| C. | NumberFormatException |
| D. | None |
| Answer» D. None | |
| 22. |
There is one default constructor in every class. |
| A. | The above statement is true |
| B. | The above statement is false |
| C. | Both true and false |
| D. | None |
| Answer» B. The above statement is false | |
| 23. |
The keyword which indicates that a method can be accessed by only one thread at a time is |
| A. | Strictfp |
| B. | Synchronized |
| C. | New |
| D. | None |
| Answer» C. New | |
| 24. |
public class Threads2 implements Runnable {_x005F_x000D_ public void run() {_x005F_x000D_ System.out.println("run.");_x005F_x000D_ throw new RuntimeException("Problem");_x005F_x000D_ Which among the following is true?_x005F_x000D_ }_x005F_x000D_ public static void main(String[] args) {_x005F_x000D_ Thread t = new Thread(new Threads2());_x005F_x000D_ t.start();_x005F_x000D_ System.out.println("End of method.");_x005F_x000D_ }_x005F_x000D_ } |
| A. | java.lang.RuntimeException: Problem |
| B. | run. java.lang.RuntimeException: Problem |
| C. | End of method. java.lang.RuntimeException: Problem |
| D. | End of method. run. java.lang.RuntimeException: Problem |
| Answer» E. | |
| 25. |
Keeping the actoins and attributes together under a single unit is called |
| A. | Encapsulation |
| B. | Information Hiding |
| C. | Polymorphism |
| D. | Inheritance |
| Answer» B. Information Hiding | |
| 26. |
public abstract class Shape {_x005F_x000D_ private int x;_x005F_x000D_ private int y;_x005F_x000D_ public abstract void draw();_x005F_x000D_ public void setAnchor(int x, int y) {_x005F_x000D_ this.x = x;_x005F_x000D_ this.y = y;_x005F_x000D_ }_x005F_x000D_ }_x005F_x000D_ Which two classes use the Shape class correctly? |
| A. | public class Circle implements Shape { private int radius; |
| B. | public abstract class Circle extends Shape { private int radius; } |
| C. | public class Circle extends Shape { private int radius; public void draw(); |
| D. | None |
| Answer» C. public class Circle extends Shape { private int radius; public void draw(); | |
| 27. |
main() {_x005F_x000D_ int i;_x005F_x000D_ printf("%d",scanf("%d",&i)); // value 10 is given as input here_x005F_x000D_ } |
| A. | 1 |
| B. | 2 |
| C. | 3 |
| D. | 4 |
| Answer» B. 2 | |
| 28. |
Javascript is interpreted by |
| A. | Server |
| B. | Object |
| C. | Client |
| D. | None of the above |
| Answer» D. None of the above | |
| 29. |
In RDBMS, what is the efficient data structure used in the internal storage representation? |
| A. | Stack |
| B. | Queue |
| C. | B+ tree structure |
| D. | AVL tree Structure |
| Answer» D. AVL tree Structure | |
| 30. |
Inside an interface when should the variables be initialized? |
| A. | Globally |
| B. | Whenever required |
| C. | Inside a function |
| D. | During the time of declaration |
| Answer» E. | |
| 31. |
In a single virtual machine, the Java programming language passes arguments by |
| A. | Refference |
| B. | Value |
| C. | Both A and B |
| D. | None |
| Answer» C. Both A and B | |
| 32. |
How many of the following will follow JavaBean Listener naming rules?_x005F_x000D_ addListener_x005F_x000D_ addMouseListener_x005F_x000D_ deleteMouseListener_x005F_x000D_ removeMouseListener_x005F_x000D_ registerMouseListener_x005F_x000D_ |
| A. | 1 |
| B. | 2 |
| C. | 3 |
| D. | 4 |
| Answer» C. 3 | |
| 33. |
How many constructors can a class have? |
| A. | 1 |
| B. | 2 |
| C. | 4 |
| D. | None of the above |
| Answer» E. | |
| 34. |
Convert the expression ((A + B) * C – (D – E) ^ (F + G)) to equivalent  Postfix notations. |
| A. | AC + B * DE - FG +^- |
| B. | AB + C * DE - FG + ^- |
| C. | AC + B* DE - FG -+ ^ |
| D. | AB + C * DE - FG -+ ^ |
| Answer» C. AC + B* DE - FG -+ ^ | |
| 35. |
Client code having direct access to internal data is called |
| A. | Encapsulation |
| B. | DataHiding |
| C. | Polymorphism |
| D. | DataAbstraction |
| Answer» C. Polymorphism | |
| 36. |
By whom will the unallocated memory that is no longer needed will be cleared in java? |
| A. | Java Virtual Machine |
| B. | Garebage collector |
| C. | Both A and B |
| D. | None |
| Answer» C. Both A and B | |
| 37. |
An algorithm written once which can be used in many places is called |
| A. | Block |
| B. | Function |
| C. | Datatype |
| D. | None |
| Answer» C. Datatype | |
| 38. |
A lock can be acquired on a class._x005F_x000D_ The above statement is |
| A. | 1 |
| B. | |
| C. | Both A and B |
| D. | None |
| Answer» B. | |
| 39. |
What is the string contained in s after following lines of code?_x005F_x000D_ StringBuffer s = new StringBuffer(“Helloâ€); s.deleteCharAt(0);  ? |
| A. | llo |
| B. | Hllo |
| C. | ello |
| D. | H |
| Answer» D. H | |
| 40. |
void waitForSignal() {_x005F_x000D_ Object obj = new Object();_x005F_x000D_ synchronized (Thread.currentThread()) {_x005F_x000D_ obj.wait();_x005F_x000D_ obj.notify();_x005F_x000D_ }_x005F_x000D_ }_x005F_x000D_ Which statement is true? |
| A. | This code can throw an InterruptedException. |
| B. | This code can throw an IllegalMonitorStateException. |
| C. | This code can throw a TimeoutException after ten minutes |
| D. | All the above |
| Answer» C. This code can throw a TimeoutException after ten minutes | |