Order PDF of any content from our website with a little minor Fee to donate for hard work. Online MCQs are fully free but PDF books are paid. For details: contact whatsapp +923028700085 Important notes based PDF Books are available in very little price, starting from 500/-PKR; Order Now: contact whatsapp +923028700085

VU Past Papers CS506 – Web Design and Development Midterm Most important MCQs Solved

Q#1: If we remove static from the main method, what will happen?
(A) Program cannot compile
(B) Program will compile and work properly
(C) Run time errors
(D) Exception throws in main
Answer: (A) Program cannot compile

Q#2: If we remove String array from the main method then the program will:
(A) Program cannot compile
(B) Program will compile and work properly
(C) Run time errors
(D) Exception throws in main
Answer: (C) Run time errors

Q#3: Java was developed in which year?
(A) 1990
(B) 1995
(C) 1997
(D) 2000
Answer: (B) 1995

Q#4: Which method is invoked by AWT to support painting operations?
(A) paint()
(B) repaint()
(C) draw()
(D) redraw()
Answer: (A) paint()

Q#5: When defining a method, which clause is used to declare exceptions that may be thrown?
(A) try block
(B) finally block
(C) catch block
(D) throws clause
Answer: (D) throws clause

Q#6: Which class can be used for text file input besides Scanner?
(A) ObjectInputStream
(B) BufferedReader
(C) StringTokenizer
(D) None of these
Answer: (B) BufferedReader

Q#7: If no base type is specified in a Vector, Java will use:
(A) String class
(B) Integer class
(C) Object class
(D) Double class
Answer: (C) Object class

Q#8: A serializable class:
(A) Must implement readObject and writeObject
(B) Must implement only readObject
(C) No need to implement any method
(D) Must implement writeObject only
Answer: (C) No need to implement any method

Q#9: Using sockets, you can perform which operation on a network?
(A) Read
(B) Write
(C) Read/Write
(D) None of these
Answer: (C) Read/Write

Q#10: A socket is a __ communication channel between hosts.
(A) Uni-directional
(B) Bi-directional
(C) Multi-directional
(D) None of these
Answer: (B) Bi-directional

Q#11: Which object is passed as an argument to the paint() method
(A) Canvas object
(B) Graphics object
(C) Image object
(D) Paint object
Answer: (B) Graphics object

Q#12: Event source can have_ listeners registered on it.
(A) Single
(B) Double
(C) Triple
(D) Multiple
Answer: (D) Multiple

Q#13: An abstract class:
(A) Can be instantiated
(B) Can’t be instantiated
(C) Must be instantiated
(D) None of these
Answer: (B) Can’t be instantiated

Q#14: A _ defines the way and method of communication between two parties.
(A) Compiler
(B) Protocol
(C) Tool
(D) Technique
Answer: (B) Protocol

Q#15: If the main method is declared as private:
(A) Program does not compile
(B) Program compiles but does not run
(C) Program compiles and runs properly
(D) Program throws exception at compile time
Answer: (B) Program compiles but does not run

Q#16: Protected access modifier allows access:
(A) Within the same class
(B) Within subclass
(C) Within same package
(D) All of the above
Answer: (D) All of the above

Q#17: A final class can be extended.
(A) True
(B) False
(C) Sometimes
(D) None of these
Answer: (B) False

Q#18: A top-level class without any modifier is accessible to:
(A) Any class
(B) Any class within the same package
(C) Any class within the same file
(D) Any subclass of this class
Answer: (B) Any class within the same package

Q#19: Which is the correct way to get the number of elements in an array?
(A) arr.length
(B) arr.length-1
(C) arr.size()
(D) arr.length()
Answer: (A) arr.length

Q#20: Garbage collection in Java is performed by:
(A) JVM
(B) Programmer
(C) Both JVM and Programmer
(D) Operating System
Answer: (A) JVM

Q#21: Java program code is compiled into:
(A) Machine code
(B) Native code
(C) Bytecode
(D) Source code
Answer: (C) Bytecode

Q#22: Static methods can access:
(A) Instance variables
(B) Instance methods
(C) Static variables and methods
(D) Both static and instance variables
Answer: (C) Static variables and methods

Contents Copyrights Reserved By T4Tutorials