Web Design and Development MCQs with Answers
Practice important Web Design and Development MCQs with answers and explanations.
Multiple Choice Questions
Q31: How does Java handle string concatenation with integers?
- A: Converts integer to string
- B: Adds integers
- C: Multiplies integers
- D: Subtracts integers
View Answer
A
Q32: Which method is used for comparing the values of two strings in Java?
- A: == operator
- B: equals method
- C: compareTo method
- D: compare method
View Answer
B
Q33: In the StringTest class, what is the result of System.out.println("Hello" + i); where i is 4?
- A: Hello4
- B: Hello
- C: 4
- D: 9
View Answer
A
Q34: In Java, what does the args array contain when using command-line arguments?
- A: Integer values
- B: String values
- C: Float values
- D: Boolean values
View Answer
B
Q35: How do you access command-line arguments in Java?
- A: Using args.length
- B: Using args[0] and args[1]
- C: Using args.size()
- D: Using args[1] and args[2]
View Answer
B
Q36: What is the type of the args array in command-line arguments?
- A: Integer
- B: String
- C: Boolean
- D: Object
View Answer
B
Q37: How can you convert a String to an int in Java?
- A: Integer.parseInt(value)
- B: Double.parseDouble(value)
- C: Float.parseFloat(value)
- D: Boolean.parseBoolean(value)
View Answer
A
Q38: What is the primary difference between primitive data types and objects in Java?
- A: Primitive types are on the stack, objects on the heap
- B: Objects are on the stack, primitive types on the heap
- C: Both are on the stack
- D: Both are on the heap
View Answer
A
Q39: Which of the following is not a primitive data type in Java?
- A: byte
- B: Integer
- C: float
- D: char
View Answer
B
Q40: How do wrapper classes help in Java?
- A: Convert primitive types to objects
- B: Increase memory usage
- C: Slow down execution
- D: Decrease precision
View Answer
A