0% found this document useful (0 votes)
0 views4 pages

Java_Control_Structures_Questions

The document provides a comprehensive list of practice questions and solutions for Java control structures, categorized into sections: IF-ELSE, WHILE, DO-WHILE, and FOR. Each section is divided into beginner, intermediate, and advanced level questions, covering various topics such as number classification, loops, and patterns. It serves as a resource for learners to enhance their understanding and application of Java control structures.

Uploaded by

kumud yadav
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)
0 views4 pages

Java_Control_Structures_Questions

The document provides a comprehensive list of practice questions and solutions for Java control structures, categorized into sections: IF-ELSE, WHILE, DO-WHILE, and FOR. Each section is divided into beginner, intermediate, and advanced level questions, covering various topics such as number classification, loops, and patterns. It serves as a resource for learners to enhance their understanding and application of Java control structures.

Uploaded by

kumud yadav
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/ 4

Java Control Structures Practice Questions & Solutions

Section: IF-ELSE

Beginner Level Questions

1. Check if a number is even or odd.

2. Check if a number is positive, negative, or zero.

3. Find the largest of two numbers.

4. Check if a year is a leap year.

5. Check if a person is eligible to vote (age >= 18).

Intermediate Level Questions

6. Find the largest among three numbers.

7. Check if a character is a vowel or consonant.

8. Find the grade from marks: 90+ -> A, 80-89 -> B, 70-79 -> C, below 70 -> F.

9. Check if a number is divisible by 5 and 11.

10. Check if a triangle is valid (sum of 3 angles = 180 degrees).

Advanced Level Questions

11. Classify a triangle based on sides (Equilateral, Isosceles, Scalene).

12. Check if a number is a palindrome using only if-else.

13. Check if a number is Armstrong or not using only if-else.

14. Create a mini ATM menu with options using if-else.

Section: WHILE

Beginner Level Questions

1. Print numbers from 1 to 10.

2. Print even numbers up to N.

3. Calculate sum of digits of a number.

4. Reverse a number.

5. Print multiplication table of a number.


Java Control Structures Practice Questions & Solutions

Intermediate Level Questions

6. Count the number of digits in a number.

7. Find the factorial of a number.

8. Check if a number is a palindrome.

9. Generate Fibonacci series up to N terms.

10. Count vowels in a word.

Advanced Level Questions

11. Find GCD (HCF) of two numbers using loop.

12. Find LCM of two numbers.

13. Convert binary to decimal.

14. Generate prime numbers between 1 and N using loop.

Section: DO-WHILE

Beginner Level Questions

1. Print menu until user chooses to exit.

2. Read numbers until user enters a negative number.

3. Repeat asking password until it matches the original.

4. Sum of N natural numbers.

5. Print table of a number till user wants.

Intermediate Level Questions

6. Create a simple number guessing game.

7. Keep accepting marks till user enters -1, then print average.

8. Count even and odd numbers till user stops.

9. Validate input: user must enter number between 1 to 10.

10. Find cube of numbers entered till user says 'no'.


Java Control Structures Practice Questions & Solutions

Advanced Level Questions

11. Simulate ATM operations with continuous options (Withdraw, Deposit, Exit).

12. Password retry system (3 tries max).

13. Find repeated digits in a number.

14. Print all digits of a number in reverse.

Section: FOR

Beginner Level Questions

1. Print numbers from 1 to N.

2. Print the square of first N numbers.

3. Print factorial of a number using for.

4. Print sum of all even numbers up to N.

5. Print a simple star pattern:

**

***

****

Intermediate Level Questions

6. Print reverse star pattern:

****

***

**

7. Print number triangle:

12

123

1234
Java Control Structures Practice Questions & Solutions

8. Find sum of series: 1 + 2 + 3 + ... + N

9. Check if a number is prime.

10. Count frequency of a digit in a number.

Advanced Level Questions

11. Print pyramid pattern:

***

*****

12. Print Floyd's Triangle.

13. Check Armstrong number using for loop.

14. Generate multiplication table for 1 to 10.

15. Find all prime numbers between 1 and 100.

You might also like