Skip to main content

Web Services Development MCQs with Answers

Practice important Web Services Development MCQs with answers and explanations.

Multiple Choice Questions

Q171: Which keyword is used to create an object in Java?
  • A: create
  • B: instantiate
  • C: new
  • D: object
View Answer
C

Q172: What is the purpose of a constructor in a class?
  • A: Initialize objects
  • B: Declare variables
  • C: Define methods
  • D: Allocate memory
View Answer
A

Q173: In Java, which of the following is a no-argument constructor?
  • A: public Class() {}
  • B: public Class(int x) {}
  • C: public void Class() {}
  • D: public Class() int {}
View Answer
A

Q174: When an object is created, what is returned by the 'new' operator?
  • A: A reference to the object
  • B: A copy of the object
  • C: The name of the object
  • D: The class of the object
View Answer
A

Q175: Which of the following statements is TRUE about reference variables?
  • A: They store primitive data types
  • B: They hold the memory address of objects
  • C: They cannot be null
  • D: They are initialized automatically
View Answer
B

Q176: Which of the following is required when declaring a method in Java?
  • A: A return type
  • B: A class name
  • C: A field variable
  • D: An interface
View Answer
A

Q177: Which access modifier is the most restrictive in Java?
  • A: public
  • B: protected
  • C: private
  • D: default
View Answer
C

Q178: What will be the output if both 'r1' and 'r2' refer to the same Rectangle object and 'r2.length = 20;' is executed after 'r1.length = 10;'?
  • A: r1.length = 10; r2.length = 20
  • B: r1.length = 20; r2.length = 10
  • C: r1.length = 20; r2.length = 20
  • D: r1.length = 10; r2.length = 10
View Answer
C

Q179: Which keyword is used to declare a method that doesn't return a value?
  • A: void
  • B: return
  • C: null
  • D: private
View Answer
A

Q180: What does the term "instantiating a class" refer to in Java?
  • A: Creating an object
  • B: Declaring a method
  • C: Defining a variable
  • D: Implementing an interface
View Answer
A

Test Your Knowledge

Take a timed quiz on Web Services Development

🚀 Start Quiz Now