Академический Документы
Профессиональный Документы
Культура Документы
Duration: 1 Hrs.
[2 x 5 =10]
a) What is a constructor?
b) int x = 90, y = 40, z;
What is the value of z in
z *= ++x * (y--) y ?
Show the steps.
c) What is the purpose of default in switch statement?
d) What is an object?
e) What are keywords? Give any two examples.
Question 2
[4+2+4=10]
x = Math.round( - 69.4);
x = Math.rint( - 69.4);
iii)
iv)
x = Math.ceil( - 69.4);
x = Math.floor( - 69.4);
Question 3
[10]
Write a program to read a number and find the product of all its even digits
Question 4
[10]
Write a function that accepts an integer parameter and checks whether it is a prime no. or not.
Page 1 of 2
Question 5
[5+5]
1
12
123
1234
12345
ii).
SHIKHA
SHIKH
SHIK
SHI
SH
S
Question 6
[10]
Write a Java program to read a string and check whether the given string contains any consecutive
vowels or not. If it contains any two vowels one after the other, print YES else print NO.
Sample input:
Output:
Aarzoo
YES
Sample input:
Output:
Shubhansh
NO
Question 7
[10]
Define a class Employee having the following description:Data members
int pan
String name
double taxincome
double tax
Member Functions:
Employee( )
Employee( )
input( )
display( )
non-parameterised constructor
parameterised constructor
to read PAN number, name and taxincome
calculate tax and display the details of an employee
Write a program to compute the tax according to the given conditions and display the output as per
given format.
Output:
Pan Number
-
Name
-
Tax-income
-
Page 2 of 2
Tax
-