IEEE Tech Event Contest

Reviewed by 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: 432
| Attempts: 432
SettingsSettings
Please wait...
  • 1/6 Questions

    A class cannot be declared ......

    • Public
    • Private
    • Default
Please wait...
Error Handling Quizzes & Trivia
About This Quiz

The 'IEEE Tech Event Contest' quiz tests knowledge on Java programming, focusing on data types, visibility modifiers, and common compile-time and runtime errors. It's designed to enhance understanding of Java's fundamental concepts and error management.


Quiz Preview

  • 2. 

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

    • Compile Error

    • Runtime Error

    • 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:

  • 3. 

    Following code will result in: int a = 3.5;

    • Compilation error

    • Runtime error

    • A will equal 3.5

    • 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. 

    What is the size of a Char in Java?

    • 1 bit

    • 4 bit

    • 8 bit

    • 16 bit

    Correct Answer
    A. 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:

  • 5. 

    A class can be transient

    • True

    • False

    Correct Answer
    A. 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:

  • 6. 

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

    • Compilation error: Divisions must be in a try block.

    • Compilation error: DivideByZeroException

    • Runtime Exception

    • No Error: a is Null

    Correct Answer
    A. 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:

Quiz Review Timeline (Updated): Mar 20, 2023 +

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.