Question 3
10 MARKS
a) Write the java expression for
xy' +lxy!
Answers
Answer:
and the catalogue of really really really RR Martin really excited to Europe rurhxgusus email E E regards Michael sent from your response regarding
Explanation:
dearu and experience right regards John and experience will be able and interested to work on the road and the remaining questions i have only been to
Show Answer
(d) Differentiate between operator and expression. [2]
Show Answer
(e) If m=5 and n=2 output values of m and n after execution in (i) and (ii):
(i) m- = n
(ii) n= m + m/n [2]
Show Answer
Question 3
(a) What will be the output of the following, if x = 5 initially?
(i) 5 * ++x
(ii) 5 * x++ [2]
Show Answer
(b) What is the output of the following?
char c = 'A';
short m = 26;
int n = c+m;
System.out.println(n); [2]
Show Answer
2006
Question 1
(c) Define variable. [2]
Show Answer
(e) What is the purpose of the new operator? [2]
Show Answer
Question 2
(a) State the two kinds of data types. [2]
Show Answer
(d) Find the output of the following program segment, when:
(i) val = 500
(ii) val = 1600
int val, sum, n = 550;
sum = n + val > 1750 ? 400 : 200;
System.out.println(sum); [2]
Show Answer
(f) What will be the output for the following program segment?
int a = 0, b = 30, c = 40;
a = --b
Show Answer
(d) Name the following:-
(i) A package that is invoked by default.
(ii) A keyword, to use the classes defined in a package. [2]
Show Answer
(e) Name the class that is used for different mathematical functions. Give an example of a function. [2]
Show Answer
Question 3
(a) State the difference between = and ==. [2]
Show Answer
(b) Write an equivalent Java expression: a=0.05-2y / (x-y) [2]
Show Answer
(c) Rewrite the following using Ternary operator:
if(income<=10000)
tax = ]
Show Answer
Question 2
(a) Evaluate the value of n if the value of p = 5, q = 19
int n = (q-p)>(p-q) ? (q-p) : (p-q); [2]
Show Answer
(b) Arrange the following primitve data types in ascending order of their size:
(i) char (ii) byte (iii) double (iv) int [2]
Show Answer
(c) What is the value stored in variable res given below:
double res = Math.pow(“345”.indexOf(‘5’),3); [2]
Show Answer
Question 3
(e) Name the mathematical function which is used to find sine of an angle given in radians? [2]
Show Answer
(i) Write Java expressions for
a2 + b2 / 2ab [2]
Show Answer
(j) If int y=10,then find int z=(++y * (y++ + 5); [2]
Show Answer
2016
Question 1
(b) What are keywords? Give an example. [2]
Show Answer
Question 2
(b) What are the types of casting shown by the following examples:
(i) char c=(char)120; (ii) int x=’t’; [2]
Show Answer
Question 3
(b) Give the output of the following Math functions:
(i) Math.ceil(4.2)
(ii) Math.abs(-4) [2]
Show Answer
(i) Give the output of the following expression:
a+=a++ + ++a + --a + a--; when a=7 [2]
Show Answer
2017
Question 1
(b) Name the operators listed below:
(i) < (ii) ++ (iii) && (iv) ? : [2]
Show Answer
(c) State the number of bytes occupied by char and int data types. [2]
Show Answer
(d) Write one difference between / and % operator. [2]
Show Answer
Question 2
(a) Name the following:
(ii) Any one reference data type [2]
Show Answer
(e) Write the output:
char ch=‘F’;
int m=ch;
m=m+5;
System.out.println(m+" "+ch); [2]
Show Answer
Question 3
(a) Write a Java expression for the following:
ax5+bx3+c [2]
Show Answer
(b) What is the value of x1 if x=5?
x1=++x - x++ + - -x [2]
Show Answer
2018
Question 1
(c) Classify the following as primitive or non-primitive data types:
(i) char (ii) arrays
(iii) int (iv) classes [2]
Show Answer
Question 2
(c) (i) int res = ‘A’;
What is the value of res? [2]
Show Answer
(d) Write the return data type of the following.
(i) endsWith() (ii) log() [2]
Show Answer
Question 3
(f) Write a Java expression for the following:
√(3x+x^2 )/(a+b) [2]
Show Answer
(g) What is the value of y after evaluating the expression given below?
y+= ++y + y-- + --y; when int y = 8 [2]
Show Answer
(h) Give the output of the following:
(i) Math.floor(-4.7) (ii) Math.ceil(3.4) + Math.pow(2,3) [2]
Show Answer
(j) Write the output of the following:
System.out.println(“Incredible”+”\n”+”India”); [2]
Show Answer
(i) Rewrite the following using ternary operator:
if(bill>10000)
discount=bill*10.0/100;
else
discount=bill*5.0/100; [2]
Show Answer
2019
Question 1
(a) Name any two principles of Objetc-oriented Programming. [2]
Show Answer
(b) Write a difference between unary and binary operator. [2]
Show Answer
(d) Write memory capacity of short and float data type in bytes [2]
Show Answer
(e) Identify and name the following tokens:
(i) public
(ii) ‘a’
(iii) ==
(iv) { } [2]
Show Answer
Question 2
(b) Give output:
String P=”20”, Q=”19”;
int a=Integer.parseInt(P);
int b =Integer.parseInt(P);
System.out.println(a+""+b); [2]
Show Answer
Question 3
(a) Write a Java expression for the following:
|x2+2xy| [2]
Show Answer
(b) Write return type of the following functions: (ii) random() [2]
Show Answer
(c) If the basic=1500, what will be the value of tax after the following is executed? tax=basic>1200?200:100; [2]
Show Answer
(f) Give output: Math.sqrt(Math.max(9,16)); [2]
Show Answer
(h) Evaluate the following expression if the value of x=2,y=3 and z=1.: v=x+--z+y+++y [2]