[Go to site: main page, start]

0% found this document useful (0 votes)
8 views3 pages

Java Programming Quest Bank Guide

The document is a question bank for a JAVA course at GITA Autonomous College, Bhubaneswar, containing various programming and theoretical questions. It includes sections on tokens, object-oriented programming concepts, data types, inheritance, constructors, and algorithms. Each question is designed to assess knowledge of Java programming and its principles.

Uploaded by

Kumar Susil
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Java Programming Quest Bank Guide

The document is a question bank for a JAVA course at GITA Autonomous College, Bhubaneswar, containing various programming and theoretical questions. It includes sections on tokens, object-oriented programming concepts, data types, inheritance, constructors, and algorithms. Each question is designed to assess knowledge of Java programming and its principles.

Uploaded by

Kumar Susil
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

GITA Autonomous College, Bhubaneswar.

Quest Bank on JAVA


Section A (1.5 Marks each)
1. Identify the kind of tokens in the following list.
++ , return, ‘A’ , {}
2. Write a java statement to print the sum of first and last element of an array N.
3. Write the name of all integer data types used in java along with their memory size and range of values.
4. Name the OOP concept implemented by using i) Base class & Derived Class
ii) Function Overloading
5. How to create an object of a class in java? Explain with an example.
6. What happens when a class doesn’t have any constructor defined in it?
7. What do you know by method overriding?
8. Define multiple inheritance. How it is implemented indirectly in java?
9. What is a byte code? How it is different from object code?
10. Differentiate between abstract class and interface.
11. Write difference between String and StringBuffer class.
12. Explain the meaning of widening and narrowing conversion.
13. What is value of y after the following switch statement is executed.
int x=3, y=3;
switch(x+3)
{
case 6: y=1;
default: y+=1;
}
14. Explain the difference between static and non static data member.
15. Give examples to illustrate the use of length and length() in java.
16. Write output of the following.
String s=”New Delhi”;
[Link]([Link](‘e’)+[Link](‘e’));
17. What is package? Describe various purpose for which package is created.
18. Explain the String methods compareTo() and equals() with examples.
19. Write a java statement to declare a class ‘Test’ that inherits a class ‘Base’ and implements two interfaces
Interface1 and InterFace2.
20. Find output of the following code segment.
int x=2,y=50;
do {
+ + x;
y - = x++; }
while(x<=10);
[Link](y);
21. Find output of the following program.
Int N[ ] = {12, 8, 5, -7, 4, 9 , 15};
[Link](N[[Link]-2]);
[Link](N[ N[3]+N[5] ]);
[Link]([Link](N[5]));
22. Find the output of following code segment:
int a=28 ;
String s=””;
while(a>0){
s=s+(a%2);
a=a/2; }
[Link](s);
23. Arrange the following data types of Java in the ascending order of their size.
24. Explain irregular array with an example.
25. What is the output of the following statement?
[Link](“BASKET”.compareTo(“BARBIE”));
26. Write a java statement to check whether second last character of a string s is in upper case or not.
27. What is run time polymorphism.
28. Write three differences between primitive and reference data type in java.
29. Why a class is known as composite type?
30. How many times does the following loop executes and what is the output of the code?
int I;
for(i=10;i>=5;i++)
[Link](i);
[Link](i*5);

Section – B (4 marks each )

1. What is inheritance? Explain all types of inheritance.


2. Write program to swap value of two variables by accepting them through Scanner input.
3. Write a small java code to illustrate the concept of constructor overloading.
4. Write two uses of super keyword with suitable example/code.
5. Write java program to input a temperature in Fahrenheit and convert it to Celsius using the following
conversion formula. C=(F-32)/1.8
6. Explain different types of access specifiers used in java.
7. What is a constructor? Write a java program to explain how a super class constructor is called in their sub
classes.
8. Explain the different uses of final keyword in java.
9. Write a program to print the sum of the following series:
2 – 4 + 6 – 8 + 12 – 16 + ……… - 40
10. Write a nested for loop to print the following pattern.
1
2 3
3 4 5
4 5 6 7 8
5 6 7 8 9 10
11. Write the name of all primitive data types along with their memory size and range of values ( for integer types
only).
12. Write a java program to create and display a unit matrix of size 4.
13. Explain the purpose of the following statements
break, return and [Link](0)
14. Write a program to print factorial of an input number n.
15. Explain the purpose of an abstract method with an example.

Section – C (8 marks for each two bits)


1. Write a program to print sum of all prime numbers up to n.
2. Write a program to reverse an input number and check whether or not it is a palindrome ( The number is same
as its reverse ).
3. Write a program to input 10 integers into an array and print the second highest number.
4. Write a program to input three angles of a triangle and print whether it is an acute angled
( each angle <90) , Obtuse angled(one of the angle >90) or right angled(One angle = 90)
5. Write a program to print the sum of the following series.
S= 1! + 2! + 3 ! +…….+N! (accept value of N as input)
N!= 1 * 2*3*4*…*N
6. Write a program to accept two numbers as command line arguments and display their hcf.
7. Write a program to input a sentence. Convert it to uppercase. Count and display number of vowels in it.
8. Write a program to input a sentence. Display number of Capital letters, No. of small letters, No. of digits and
No. of special characters.
9. Write a program to input 9 elements each into two 2-D arrays(matrices) and print whether they are not equal
or not.
10. Define base class Employee with data members to store name, empno and salary a parameterized constructor
and method to display data members. Derive another class Manager with data member department number,
bonus and total salary. Define parameterized constructor to initialize data members of both classes and
display them by using another method.
11. Write a program to define an overloaded method volume() to calculate and print volume of a cuboid , cube ,
sphere and cylinder.
12. Write a program to input a string and display the string by removing all duplicate characters so that the string
contains only unique characters.
e.g INPUT : radhakrishan
OUTPUT : radhkisn
13. Write program to input a word and print whether or not it is a palindrome word or special word or neither
Palindrome nor special word.
Palindrome Word: MADAM, MALAYALAM etc (word and its reverse are same)
Special Word: XEROX , UBUNTU (First and last alphabets are same)

-------------------------O-----------------------

You might also like