Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Question 1.

i. What is the output of Math.pow(Math.sqrt(25),2)?


a)5.0 b) 5 c) 25 d)25.0
ii. How many argument can be passed in to Math.max()?
a)1 b)2 c)3 d)4
iii. What is the output of Math.max(-3.5,2.3)+Math.min(2.4,1.4)?
a)2.3 b)1.2 c)3.7 d) 4
iv. Output of System.out.println(Math.max(Math.min(4.5,7.4),5.3)))?
a)7.4 b)4.5 c)5.3 d) None
v. OutPutSystem.out.println(Math.floor(4.9)+Math.ceil(4.1))?
a)9 b)9.0 c)8 d)8.0
vi. What is the size of float data type?
a)4bits b)4 bytes c) 8 bits d) 8bytes
vii. A constant value is called a ______
a)Literal b) token c) punctuator d) variable
viii. Which of the following is the new line character?
a)\t b)\’ c)\n d)\N
ix. A _____ is the smallest unit which depicts the smallest part of a program
a)Literal b) token c) Identifier c) separators
x. Which keyword is used to exit from switch case?
a)continue b)break c) return d)exit
xi. Which of the following is a conditional statement?
a)for b)switch c)if else d)none
xii. Data type of choice variable in switch case should not be ___
a)float b) char c)int d)String
Question.2
i. Difference between if else and switch case(Two points)
ii. What is Fall through?
iii. Write all primitive data types.
iv. Write 2 differences between float and double data types.
v. What is Escape Sequence? Write 2 examples of Escape characters.
Question 3.
i. Write the output:-
System.out.println(“There are\nthree types of \\flow\\ of control”);
ii. Write the output:-
a. System.out.println(7 – 5 *3);
b. System.pout.println(10 * 6/3);
c. System.out.println(10 /5 * 5 +5);
d. System.out.println(4 % 2 * 10 -10);
Section C (Attempt any 3 questions):
Question 3. WAP to input marks of 4 subjects and calculate the average marls of subject and
allocate a grade to the students as per the following rules.
Average Marks Grade
>=90 A
>= 80 and <90 B
>=70 and <80 C
>=60 and <70 D
<60 E
Question 5. Write a Menu driven program to do the following :-
1. Area of rectangle 2.Area of Circle 3. Area of Square
For an incorrect choice give an appropriate error message.
Question 6.
Write a menu driven program using switch case to do the following:-
1. Volume of sphere (4/3πr3) 2. Volume of cylinder (πr2h )3. Volume of cone (πr2h/3)
For an incorrect choice give an appropriate error message.
Question 7. Write a program to input the principal amount, rate and time and calculate the
compound interest and the amount to be paid.
CI=P(1+R/100)T Amt=P +CI

You might also like