πŸ’‘ Jump to Important Questions ↓

Important Questions

Important Questions

Programming in Java

Asked in 2081Short Question5 Marks
1.
Assume that a text file named 'ONE.TXT' contains a paragraph of text. Write a program to copy the word that starts with vowel from 'ONE.TXT' to another file 'TWO.TXT'. [5]
Asked in 2081Long Question10 Marks
2.
Differentiate between path and class path in Java. When do you prefer anonymous inner class? Consider the following program and answer the given questions. 1) Name the list of class file created after compiling above program 2) Rewrite the above program using for loop [10]
Asked in 2080Short Question5 Marks
3.
Suppose that 9 integers are written in a file named 'magic.txt' in the arrangement of 3 x 3 separated by space. Write a program to check whether the integers in all rows, all columns, and both diagonals sum to the same constant or not. [5]
Asked in 2080Long Question10 Marks
4.
Why do we need to synchronize the thread? Justify with an example. An array with an odd number of elements is said to be centered if all elements (except the middle one) are strictly greater than the value of the middle element. Note that only arrays with an odd number of elements have a middle element. Write a function that accepts an integer array and returns 1 if it is a centered array, otherwise it returns 0. [10]
Asked in 2079Short Question2.5+2.5 Marks
5.
Write short notes on: a. Final class b. Result set [2.5+2.5]
Asked in 2079Short Question5 Marks
6.
What is multithreading? How can you create multithreaded program in Java? Explain. [5]
Asked in 2079Long Question10 Marks
7.
Explain feature of object-oriented programming. Create a class Distance with private variables feet of type integer and inches of type floating point. Use suitable constructor, and methods for adding and comparing two distance objects. [Hint: 1 feet = 12 inches] [10]
Asked in 2078Short Question5 Marks
8.
What is package? How can you create your own package in Java? Explain with example. [5]
Asked in 2077Short Question5 Marks
9.
Why synchronization is essential in multithreading? Describe. [5]
Asked in 2077Short Question5 Marks
10.
Why multiple inheritance is not allowed in Java using classes? Give an example. [5]
Asked in 2077Short Question5 Marks
11.
What is the task of manifest file? Write the procedure to create it. [5]
Asked in 2077Short Question5 Marks
12.
When does the finally block is mandatory in while handling exception? Describe with a suitable scenario. [5]
Asked in 2077Short Question5 Marks
13.
A non-empty array A of length n is called an array of all possibilities if it contains all numbers between 0 and A.length-1 inclusive. Write a method named isAllPossibilities that accepts an integer array and returns 1 if the array is an array of all possibilities, otherwise it returns 0. [5]
Asked in 2076Short Question5 Marks
14.
Write a simple Java program that reads a file named 'Test.txt' and displays its contents. [5]
Asked in 2076Short Question5 Marks
15.
Define class. How do you create a class in Java? Differentiate class with interface. [5]
Asked in 2076Long Question10 Marks
16.
What is exception handling? Discuss the use of each keyword (try, catch, throw, throws and finally) with suitable Java program. [10]
Asked in 2075Short Question5 Marks
17.
Give any two differences between class and bean. Write the steps to create JAR files. [5]
Asked in 2075Short Question5 Marks
18.
When do we use final method and final class? Differentiate between function overloading and function overriding. [5]
Asked in 2075Short Question5 Marks
19.
Write down the life cycle of thread. Write a program to execute multiple threads in priority base. [5]
Asked in 2075Short Question5 Marks
20.
Define the chain of constructor. What is the purpose of private constructor? [5]
Asked in 2075Short Question5 Marks
21.
An array is called balanced if it's even numbered elements (a[0], a[2], etc) are even and its odd numbered elements (a[1], a[3], etc) are Odd. Write a function named isBalanced that accepts an array of integers and returns 1 if the array is balanced otherwise it returns 0. [5]
Asked in 2075Long Question10 Marks
22.
Why do we need to handle the exception? Distinguish error and exception. Write a program to demonstrate your own exception class. [10]