12 An2 C11 Comqp
12 An2 C11 Comqp
Question 4
(i) Give the output, if the following statements are executed
(a) int c = (3<4)? 3*4:3+4; [1]
(b) int a = 14, b=4; [1]
boolean x = (a>b)? true: false;
(c) int x = 90; [1]
char c = (x<=90)? ‘Z’: ‘10’;
(d) int a = 18; int b= 12;
boolean t = (a>20 && b<15)? true: false; [1]
(e) c = (val + 550 < 1700)? 200? 400; [1]
If val = 1000
(ii) (a) What are the three main types of operators? Name them. [1]
(b) What do you understand by Unary Operator? Explain with a suitable example. [2]
(c) Difference between Arithmetical Expression and Arithmetic Statement with a suitable example. [2]
Question 5
(i) Write a program in Java to find the amount and compound interest by using function argument. [5]
(ii) Distinguish between: Syntax error and Logical error [3]
(iii) What is a package in Java? Give an example. [2]
Question 7
Write a program in Java to store 20 numbers in a Single Dimensional Array and print the greatest and [10]
smallest number in the given set of numbers.
Question 8
Write a program in java to store 20 numbers in a Single Dimensional Array. Search whether a given number
is present or not by using binary search technique. If it is present then display the number along with a message
whether it is an even/odd/positive or negative number. [10]
Question 11
Write a program in Java to input two numbers. Display the H.C.F and L.C.M of both the numbers. [5]