0% found this document useful (0 votes)
31 views

Questions

1. The document provides 5 questions about conditional statements in Java. The questions cover printing positive/negative numbers, checking for a fever, using switch case to print days of the week, evaluating boolean and integer expressions, and determining if a year is a leap year. 2. The questions involve writing Java code using if/else statements, switch case, boolean logic, and modulo operators to evaluate conditions and return the appropriate outputs. 3. Hints are provided for the leap year question involving modulo operators to check if a year is divisible by 4, 100, and 400 to determine if it is a leap year.

Uploaded by

shubhamlangade63
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Questions

1. The document provides 5 questions about conditional statements in Java. The questions cover printing positive/negative numbers, checking for a fever, using switch case to print days of the week, evaluating boolean and integer expressions, and determining if a year is a leap year. 2. The questions involve writing Java code using if/else statements, switch case, boolean logic, and modulo operators to evaluate conditions and return the appropriate outputs. 3. Hints are provided for the leap year question involving modulo operators to check if a year is divisible by 4, 100, and 400 to determine if it is a leap year.

Uploaded by

shubhamlangade63
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

APNA

COLLEGE

CONDITIONAL STATEMENTS QUESTIONS

Question 1: Write a Java program to get a number from the user and print whether it is

positive or negative.

t
bo
Question 2: Finish the following code so that it prints You have a feverif your temperature
is above 100 and otherwise prints You don't have a fever.

ubliC class Solution t

h_
public static void main (String[l args) {

double temp = 103.5;

tc
DN
Question 3: Write a Java program to input week number(1-7) and print day of week name
ba
using switch case.

COLLE
Question 4: What will be the value of x & y in the following program:
a

public class Solution


publicstatic void main (String args[])
ph

int a = 63, b = 36;

boolean x= (a <b) ? true : false;

int y= (a > b )
?a b;
al
@

Question Write a Java program that takes a year from the user and print whether that
5:
year is a leap year or not.

Hint:
APNA
COLLEGEE

IS year IS year IS year


divisible Yes divisible Yes divisible Leap Year
by 4? by 100? by 400 ?

No No NO

t
Not a Leap Year Leap Year Not a Leap Year

bo
h_
tc
APNA
ba

COLLEGE
a
ph
al
@

You might also like