IEEE Tech Event Contest

Approved & Edited by ProProfs Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Ahmdrmdn
A
Ahmdrmdn
Community Contributor
Quizzes Created: 1 | Total Attempts: 427
Questions: 6 | Attempts: 427

SettingsSettingsSettings
IEEE Quizzes & Trivia

Questions and Answers
  • 1. 

    What is the size of a Char in Java?

    • A.

      1 bit

    • B.

      4 bit

    • C.

      8 bit

    • D.

      16 bit

    Correct Answer
    D. 16 bit
    Explanation
    In Java, the size of a Char is 16 bits. This means that a Char data type can store Unicode characters ranging from U+0000 to U+FFFF. Unicode characters are represented using the UTF-16 encoding, which requires 16 bits of storage for each character. Therefore, the correct answer is 16 bit.

    Rate this question:

  • 2. 

    A class cannot be declared ......

    • A.

      Public

    • B.

      Private

    • C.

      Default

    Correct Answer
    B. Private
    Explanation
    The keyword "private" in Java is used to restrict access to the class members (variables and methods) to only within the same class. It means that these members cannot be accessed from outside the class, including subclasses and other classes in the same package. Therefore, declaring a class as "private" would not make sense because it would prevent any other class from accessing it, resulting in limited or no usability.

    Rate this question:

  • 3. 

    Following code will result in: int a = 3.5;

    • A.

      Compilation error

    • B.

      Runtime error

    • C.

      A will equal 3.5

    • D.

      A will equal 3

    Correct Answer
    A. Compilation error
    Explanation
    The given code will result in a compilation error because the variable "a" is declared as an integer, but it is being assigned a floating-point value (3.5). In Java, you cannot directly assign a floating-point value to an integer variable without explicit casting. Therefore, the code will not compile.

    Rate this question:

  • 4. 

    Following code will result in: int a = 9/0;

    • A.

      Compilation error: Divisions must be in a try block.

    • B.

      Compilation error: DivideByZeroException

    • C.

      Runtime Exception

    • D.

      No Error: a is Null

    Correct Answer
    C. Runtime Exception
    Explanation
    The code will result in a runtime exception because it is trying to divide 9 by 0, which is not allowed in mathematics. This will throw a runtime exception called "ArithmeticException" or "DivideByZeroException" in most programming languages.

    Rate this question:

  • 5. 

    Following code will result in: class A {       public static void main(String [] args) {             B b = new A();       } } class B extends A {}

    • A.

      Compile Error

    • B.

      Runtime Error

    • C.

      No Error

    Correct Answer
    A. Compile Error
    Explanation
    The given code will result in a compile error. This is because the line "B b = new A();" is trying to create an object of class A and assign it to a variable of class B. Since class B is a subclass of class A, this is not allowed in Java. The object being created must be of the same type as the variable it is being assigned to, or a subclass of that type. Therefore, the code will not compile.

    Rate this question:

  • 6. 

    A class can be transient

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    A class cannot be transient. The transient keyword in programming is used to indicate that a variable should not be serialized, meaning it will not be saved and restored when the object is persisted or transferred. However, the transient keyword cannot be applied to a class itself. It can only be used to mark individual variables within a class as transient. Therefore, the statement "A class can be transient" is false.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 20, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Mar 26, 2012
    Quiz Created by
    Ahmdrmdn
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.