Search Header Logo

JAVA unit 4

Authored by Ms N Suganya CSE - 2700

Computers

University

Used 1+ times

JAVA unit 4
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which class is used to read input from the console in Java?

  • A) FileReader

  • B) BufferedReader

  • C) PrintWriter

  • D) Scanner

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method is used to write data to a file in Java?

  • A) writeFile()

  • B) print()

  • C) write()

  • D) println()

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of bounded types in generics?

  • A) To allow any type as a parameter.

  • B) To restrict the types that can be used as type arguments.

  • C) To enhance performance.

  • D) To simplify code.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to define an upper bound for a generic type in Java?

  • A) super

  • B) extends

  • C) implements

  • D) restricts

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the StringBuffer class provide that the String class does not?

  • A) Immutability

  • B) Thread safety

  • C) Mutable strings

  • D) None of the above

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a valid declaration of a generic class in Java?

  • A) class MyClass<T> {}

  • B) class MyClass<T extends Number> {}

  • C) class MyClass<T extends Comparable<T>> {}

  • D) All of the above

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will happen if you try to use a non-bounded type as a generic argument in a bounded generic class?

  • A) It will compile successfully.

  • B) It will throw a runtime exception.

  • C) It will cause a compile-time error.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

Already have an account?