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 | Questions: 6
Please wait...
Question 1 / 6
0 %
0/100
Score 0/100
1. A class cannot be declared ......

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.

Submit
Please wait...
About This Quiz
Error Handling Quizzes & Trivia

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.

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

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.

Submit
3. Following code will result in: int a = 3.5;

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.

Submit
4. What is the size of a Char in Java?

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.

Submit
5. A class can be transient

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.

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

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.

Submit
View My Results

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
Cancel
  • All
    All (6)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
A class cannot be declared ......
Following code will result in:...
Following code will result in: int a = 3.5;
What is the size of a Char in Java?
A class can be transient
Following code will result in: int a = 9/0;
Alert!

Advertisement