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 Ekkoo
E
Ekkoo
Community Contributor
Quizzes Created: 4 | Total Attempts: 2,560
| Attempts: 285 | Questions: 18
Please wait...
Question 1 / 18
0 %
0/100
Score 0/100
1.
Suppose your method does not return any value, which of the following keywords can be used as return type?

Explanation

The keyword "void" can be used as a return type when a method does not return any value. It is used to indicate that the method does not have a return statement and simply performs a task or action without returning a value.

Submit
Please wait...
About This Quiz
Java Quizzes & Trivia

ITEMP Java Quiz 5 assesses knowledge of Java programming concepts through practical code examples. It covers method invocation, method overloading, and fundamental syntax such as classes and objects. This quiz is ideal for learners aiming to enhance their Java programming skills.

Tell us your name to personalize your report, certificate & get on the leaderboard!
2.
A constructor can be overloaded.

Explanation

Overloading in programming refers to the ability to define multiple methods or functions with the same name but with different parameters. Similarly, a constructor can also be overloaded, meaning that multiple constructors can be defined for a class with different parameters. This allows for flexibility in creating objects of a class, as different constructors can be used depending on the specific requirements. Therefore, the statement "A constructor can be overloaded" is true.

Submit
3.
All Java applications must have a method called __________.

Explanation

In Java, the main() method is the entry point for any Java application. It is the method that is called when the program starts running. Therefore, all Java applications must have a main() method.

Submit
4.
You must have a return statement in a non-void method. TRUE or FALSE?

Explanation

In Java, a non-void method is a method that returns a value. It is mandatory to have a return statement in a non-void method to specify the value that should be returned. If a return statement is missing, it will result in a compilation error. Therefore, the statement "You must have a return statement in a non-void method" is true.

Submit
5.
A method can be declared with no parameters. TRUE or FALSE?

Explanation

A method can indeed be declared with no parameters. In programming, parameters are used to pass information into a method. However, there are cases where a method does not require any input and can still perform its functionality. In such cases, the method can be declared with no parameters. This allows for flexibility in method design and implementation.

Submit
6.
Arguments to methods always appear within __________.

Explanation

In programming, arguments to methods are enclosed within parentheses ( ). This is the standard syntax used to pass values or variables to a method for processing. The parentheses indicate that the enclosed values are being passed as arguments to the method, allowing the method to perform its intended functionality using those values. Square brackets [ ] are typically used for indexing or accessing elements in an array or list. Curly braces { } are used for defining blocks of code or declaring sets or dictionaries. Quotation marks " " are used to denote strings or text literals. Therefore, the correct answer is parentheses ( ).

Submit
7.
A constructor always has a return type.

Explanation

A constructor does not have a return type. It is a special method that is automatically called when an object is created, and its purpose is to initialize the object's state. Unlike regular methods, constructors do not have a return type specified, not even void.

Submit
8.
An object is an instance of a __________.

Explanation

This question is asking about the definition of an object. In object-oriented programming, an object is an instance of a class. A class is a blueprint or template that defines the properties and behaviors of an object. Therefore, the correct answer is "class".

Submit
9.
When you write more than one method with the same name but different parameters in the same class, then it is called __________.

Explanation

Overload is the correct answer because when you write more than one method with the same name but different parameters in the same class, it is called method overloading. Method overloading allows you to have multiple methods with the same name but different parameter lists, and the appropriate method is called based on the arguments provided when the method is invoked. This allows for more flexibility and versatility in programming by allowing the same method name to be used for different purposes.

Submit
10.
public class Converter {           public static void main(String args [ ]) {                    Converter con = new Converter();                    con.dollartoRupees(15);          }           double dollartoRupees(int dollar) {                     System.out.println (dollar+" dollar is equivalent to Rs" +dollar*25);            } } What will be the output of this program?
 

Explanation

The output of this program will be "15 dollar is equivalent to Rs 375". This is because the main method calls the dollartoRupees method with the argument 15. Inside the dollartoRupees method, the value of the dollar parameter is multiplied by 25 and then printed along with the text "dollar is equivalent to Rs". So, when the dollartoRupees method is called with the argument 15, it will print "15 dollar is equivalent to Rs 375".

Submit
11.
The keyword __________ is required to declare a class.

Explanation

The keyword "class" is required to declare a class. In object-oriented programming, a class is a blueprint for creating objects. It defines the properties and behaviors that an object of that class will have. The "class" keyword is used to define a new class in a programming language. Therefore, the correct answer is "class".

Submit
12.
The this key word is used to

Explanation

The "this" keyword in programming is used to refer to the current object. It is typically used within a class or method to access the instance variables or methods of the current object. By using "this", we can differentiate between local variables and instance variables that have the same name. It helps in improving code readability and avoids confusion.

Submit
13.
You can declare two variables with the same name in __________.

Explanation

In Java, it is possible to declare two variables with the same name in different methods within a class. Each method has its own scope, so variables declared within a method are only accessible within that method. Therefore, it is allowed to have variables with the same name in different methods without any conflict or ambiguity.

Submit
14.
A variable that is associated with an individual object is called __________.

Explanation

An instance variable is a variable that is associated with an individual object. It is unique to each instance of a class and holds different values for different objects. This allows each object to have its own set of data and characteristics.

Submit
15.
When a new key word is used to create an instance of a class,

Explanation

When a new keyword is used to create an instance of a class in Java, all of the above actions occur. Java first allocates memory for the object, then initializes the instance variables, and finally calls the constructor. These steps are necessary to properly create and initialize a new object of the class.

Submit
16.
Analyze the following code: class Test {    public static void main(String[] args){               System.out.println(findNumber(5));       }      public static int findNumber(int n) {               System.out.println("int");               return n;        }        public static long findNumber(long n) {                 System.out.println("long");                 return n;         } }
What will happen when you execute this block of code?
 
 

Explanation

The program displays int followed by 5 because the method findNumber with an int parameter is called when the argument passed is an int value. The method with a long parameter is not called because the argument is not a long value.

Submit
17.
Variables that are shared by every instances of a class are __________.

Explanation

Class variables are variables that are shared by every instance of a class. They are declared at the class level and not inside any method or constructor. These variables belong to the class itself rather than any specific instance of the class. They can be accessed and modified by all instances of the class and are commonly used to store data that is shared among all instances, such as constants or counters.

Submit
18.
What modifier should you use on a class so that a class in the same package can access it but a class in a different package cannot access it?

Explanation

The default modifier allows a class to be accessed by other classes within the same package but not by classes in different packages. This means that any class in the same package as the class with the default modifier can access it, while classes in different packages cannot.

Submit
View My Results

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

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

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • May 15, 2011
    Quiz Created by
    Ekkoo
Cancel
  • All
    All (18)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Suppose your method does not return any value, which of the following...
A constructor can be overloaded.
All Java applications must have a method called __________.
You must have a return statement in a non-void method. TRUE or FALSE?
A method can be declared with no parameters. TRUE or FALSE?
Arguments to methods always appear within __________.
A constructor always has a return type.
An object is an instance of a __________.
When you write more than one method with the same name but different...
Public class Converter { ...
The keyword __________ is required to declare a class.
The this key word is used to
You can declare two variables with the same name in __________.
A variable that is associated with an individual object is called...
When a new key word is used to create an instance of a class,
Analyze the following code: ...
Variables that are shared by every instances of a class are...
What modifier should you use on a class so that a class in the same...
Alert!

Advertisement