0% found this document useful (0 votes)
5 views1 page

Variables Questions

The document contains a set of programming questions focused on variables and data types in Java. It includes tasks such as calculating averages, determining the area of a square, and computing the total cost of items with optional GST. Additionally, it poses questions about data types and potential errors in Java syntax for practice purposes.

Uploaded by

Azy Man
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Variables Questions

The document contains a set of programming questions focused on variables and data types in Java. It includes tasks such as calculating averages, determining the area of a square, and computing the total cost of items with optional GST. Additionally, it poses questions about data types and potential errors in Java syntax for practice purposes.

Uploaded by

Azy Man
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

VARIABLES & DATA TYPES QUESTIONS

[email protected]
Question 1 : In a program, input 3 numbers : A, B and C. You have to output the average of
these 3 numbers.
(Hint : Average of N numbers is sum of those numbers divided by N)

Question 2: In a program, input the side of a square. You have to output the area of the
square.
(Hint : area of a square is (side x side))

Question 3: Enter cost of 3 items from the user (using float data type) - a pencil, a pen and
an eraser. You have to output the total cost of the items back to the user as their bill.
(Add on : You can also try adding 18% gst tax to the items in the bill as an advanced problem)

Question 4: What will be the type of result in the following Java code?

(Hint : Look at the largest data type among these)

Question 5: (Advanced) Will the following statement give any error in Java?
int $ = 24;

Note - These questions are only to help you practice the concepts of this chapter. These are
not designed to test your mathematical skills, just to understand logic building using Java.

You might also like