Mu Java _33
Mu Java _33
2. What is the purpose of default in a switch statement? Explain with the help of an example
3. Write a JAVA program (method) to develop an application in JAVA to calculate Marks in 5
subjects and
show the percentage of Students.
4. What is the need of a constructor in OOP? Explain all features of a constructor.
5. What are control structures in Java? Explain them briefly?
6. a) Difference between return type and method arguments with a suitable example?
b) What are comment entries in java? Mention any two ways to give comments
7. Create a user defined method to find whether the number 105 appears in the given array or
not.
(The Array has 100, 102, 105, 118, 119, 123, 130, 114, 106.)
8. What are the features of object-oriented programming?
9. Write a program to print 1 to 10
a. Print even numbers between 1 to 20 using for loop.
b. Print odd numbers between 1 to 20 using while loop.
10. ‘Java is a platform Independent language’. Justify the statement.
11. Mention two ways to give comments in Java?
12. Explain about the Exception handling keywords in Java?
13. Write a program in Java to count the number of vowels and consonants in a given string.
16. Create a class – Book contains the following Data Members and Members Method.
Data Members – Title, Author, Publisher, Price Member Method – display()
17. Write a user defined method in java to perform followings:
i) To calculate the Factor of the number. ii) To calculate the Factorial of the number.
18. a) How array manipulation can be done in Java without using pointer?
b) How sort() built-in method can be used to manipulate array in Java? explain with an example.
c) Why binarySearch() built-in method is used in array? Explain with an example.
19. (a) Define Constructors . Also write two character tics of a constructor.
(b) What is a wrapper class? Explain with the help of a suitable example.
20. (i) Write a JAVA program (method) to develop an application in JAVA to calculate Marks in 5 subjects
and show the percentage of Students
21. How are exceptions handled in Java? Explain with the help of a suitable example.
22. What is the pupose of using default in a switch statement?
23. (i) Write a program in Java to display Area of a square.
(ii) What are comment entries in Java? Mention two ways to give comments.
24. Write a program in Java to display Area of a square. Differentiate between return type and method
arguments with a suitable example
25. Differentiate between = and == operator in JAVA
26. Write a for loop that displays all odd numbers between 1 to 10
27. i. How can we enable assertions to debug our code in java?
ii. What are the two ways to create threads in java? iii. Which member function of the Integer wrapper
class allows access to the int value held in it.
28. What are methods in Java? Write a user defined method that return product of two numbers
29. What is an exception? How are exceptions handled in java? Explain with example.
30. Write a code in java using a for loop to display all odd numbers between 1 to 10. Is for loop an entry
controlled loop or exit control loop?
31. What is the difference between a while and a do-while loop?
32. What is the need of JVM?
33. a. What is an exception?
b. Explain each of the following terms in exception handling i. try ii. catch iii. finally
34. a) What are Arrays? Give an example.
b) Write Java code to do the following:
i) Create an array Marks that stores values 78,65,85,91,82
ii) To print all the values of the array Marks using a loop.
iii) Display the average stored in the array Marks.
35. Write the method in Java to accept a string as parameter from the user and print whether the string
contains the character “old” or not.
36. Write a program in Java to print the average of the first ten numbers.
37. Consider the following two declarations and differentiate between them :
int a = 50; Integer
b = new Integer(50);
38. Write a method in Java that accepts two numbers as parameters and returns the greater number.
39. Differentiate between Short and String data type.
40. Write a code in Java to print the squares of numbers from 1 to 5 by using for loop.
41. Mention any two main points of difference between while and do-while statements. Also give the syntax
of both.
42. Write a method Disp_sal() in Java to display Net Salary on the basis of Basic Salary, Allowance and
Deductions to be passed as arguments of type double.
(Net Salary = Basic Salary + Allowance Deductions)
If the Net Salary is more than 50,000, additional 2000 bonus is added. Also display Net Salary.
43. Define the term Array with respect to Java.
44. Explain the access modifiers and their types in Java.
45. Write a program in Java to display area of a rectangle.
Note : Assign any imaginary values to the variables used in the program.
46. What is the difference between = and == operator in Java ? Give example to support your answer.
47. Write the two ways of creating a thread in Java.