SRM Institute of Science and Technology
Tiruchirappalli -621 105
Faculty of Engineering and Technology
Department of CSE & IT
21CSC203P–Advanced Programming Practice
Unit I & II Question Bank
PART-A
1) Write a Java program to calculate the sum of the first n even numbers.
2) Write a Java program to swap two numbers without using a temporary variable.
3) Develop a Java program that reads an integer from the user and uses an if-else statement
to classify the number as positive, negative, or zero. Display an appropriate message
reflecting the classification.
4) Create a Java program that prompts the user to input an integer. Use an if-else statement to
determine if the number is even or odd. If the number is even, display all even numbers
from 2 up to and including the input value using a for loop.
5) Write a Java program that calculates the sum of all even numbers between 1 and 50 using
a for loop.
6) Write a Java program to generate a multiplication table for a given number.
7) Write a Java program to implement a basic calculator.
8) Develop a Java program that prompts the user to enter a student's score ranging from 0 to
100. Using if-else statements, determine and print the corresponding grade based on these
criteria: A for scores between 90 and 100, B for scores between 80 and 89, C for scores
between 70 and 79, D for scores between 60 and 69, and F for scores below 60
9) Write a program that takes three integers as input and prints the maximum of the three
using if-else statements.
10) Write a Java program to check if a year is a leap year using nested if-else statements.
11) Create a Java program that reads a character from the user and uses an if-else statement to
check if it is a vowel (a, e, i, o, u) or a consonant.
12) Write a Java program that takes an integer between 1 and 12 as input and uses
a switch statement to print the name of the corresponding month.
13) Write a Java program that takes an integer input between 1 and 7 and prints the
corresponding day of the week using a switch statement.
14) Write a Java program that calculates the factorial of a number entered by the user using a
for loop.
15) Write a Java program to print the Fibonacci sequence up to a certain number.
16) Write a Java program to convert a temperature from Celsius to Fahrenheit.
17) Create a Java program that uses a for loop to print a star pattern. The number of rows for
the pattern should be specified by the user.
18) Create a program that uses a while loop to print all prime numbers between 1 and 100.
19) Write a Java program that stores a list of integers in an array. Use a while loop to identify
and display the largest and smallest numbers in the array.
20) Write a Java program to calculate the length of an array
21) Write a Java program that initializes an array of 3 integers. The program should then print
the values of the array in reverse order.
22) Write a Java program that calculates and prints the average of the values in an array of 10
integers.
23) Create a Student class in Java with the following attributes: name, rollNumber, and grades
(an array of doubles). Implement methods to calculate the average grade and check if the
student is passing (average grade ≥ 50). Write a program to instantiate a Student object, set
its attributes, and display the average grade along with the passing status.
24) Design a class Library with attributes for name, location, and a list of books (each book
can be represented by its title and author). Implement methods to add a book to the library
and list all books in the library. Write a program to create a Library object, add some books,
and display the list of books.
25) Design a class Student with attributes for name, ID, and scores (array of integers).
Implement methods to find the highest score, lowest score, and the overall grade (A, B, C,
D, or F based on average). Write a program to create a Student object, set scores, and
display the highest score, lowest score, and overall grade.
PART – B
1. How do you classify the programming paradigms and draw a neat diagram of types
programming paradigms?
2. List the elements of programming with an example
3. Explain about Böhm-Jacopini theorem with neat diagram
4. Describe about programming languages with its types
5. Explain a role of object serialization with neat diagram
6. Describe about parallel computing
7. What is role of Böhm-Jacopini theorem and justify how for it is useful in programming