Q1 Write two jump statements and their uses.
Q2 State the difference between entry controlled loop and exit controlled loop
Q3 What is the difference between a break statement and a continue statement when they occur in
a loop?
Q4 What is an infinite loop? Explain with an example.
Q5 Write syntax of i) for loop ii) while loop iii) do – while loop with appropriate examples.
Q6 State one similarity and one difference between i) while and do – while loop
ii) while and for loop
Write the Java code for the following problems-
i) WAP to print odd and even numbers between 1 to 100
ii) WAP to print table of a number taken from user.
iii) WAP to print the first ten terms of the following series-
a) 1, 4, 9, 16………
b) 1.5, 3.0, 4.5, 6.0……………………..
c) 0, 7, 20, …….
d) 1, 9, 25, 49,……………………….
e) 24, 99, 224, 399……………………..
iv) WAP to display all the ‘Buzz Numbers’ between p and q (where p<q). A ‘Buzz Number’ is the
number which ends with 7 or is divisible by 7.
v) WAP to input marks in English, Maths and Science of 40 students who have passed ICSE
Examination 2024. Now, perform the following tasks :
a) Fins and display the number of students, who have secured 95% or more in aggregate.
b) Find and display the number of students, who have secured 90% or more in English, Maths and
Science.
vi) WAP to print the sum of the given series –
1 1 1 1 1
S=1+ + + + +………………………+
2 3 4 5 20
vii) WAP to print the Mathematical Table from 5 to 10 for 10 iterations in the given format:
Sample output : Table of 5
5*1=5
5 * 2 = 10
………..
………….
5 * 10 = 50
viii) WAP to accept any 20 numbers and display only those numbers which are prime.
ix) Write a menu driven program to display all prime and non prime numbers from 1 to 100.
Enter 1 : to display all prime numbers
Enter 2 : to display all non – prime numbers
x) WAP to display the following pattern –
a) 1 1 1 1 1 b) 5 5 5 5 5 c) 1 d) 1 2 3 4 5 e) 5 4 3 2 1
22222 44444 12 1234 5432
33333 33333 123 123 543
44444 22222 1234 12 54
55555 11111 1 2 3 4 `5 1 5