76 solutions available
Question 1What is meant by token? Name the tokens available in Java.
Question 2What are keywords ? Can keywords be used as identifiers ?
Question 3What is an identifier ? What is the identifier forming rule(s) of Java?
Question 4What kind of program elements are the following ?13, 'a', 4.38925, "a", main( )
Question 5What kind of constants are the following ?14, 011, 0X2A, 17, 014, 0XBC1
Question 6What is a character constant in Java ? How are non graphic characters represented in Java ?
Question 8What is meant by implicit and explicit type conversion ?
Question 9What do you mean by type casting? What is type cast operator in Java?
Question 10What will be the resultant type of the following expression if bh represents a byte variable, i is an int variable, fl is a float variable...
Question 11What will be the resultant type of the following expression if fl is a float variable and db is a double variable?(int) (fl + db)
Question 12Determine the data type of the expression(100(1−pq)(q+r))−((p+r)/s(long)(s+p))\Big(\dfrac{100(1 - pq)}{(q + r)}\Big) - \Big(\dfrac{(p + r)...
Question 13Determine the data type of the expression(2x+3y5w+6z+8p5q)4\Big(\dfrac{2x + 3y}{5w + 6z} + \dfrac{8p}{5q}\Big)^4(5w+6z2x+3y+5q8p)4if x...
Question 14(a)State the value and type of each expression.Math.abs(-5) - Math.abs(-7)
Question 14(b)State the value and type of each expression.Math.abs(-1e-1) + Math.abs(-2e-2)
Question 14(c)State the value and type of each expression.Math.sqrt(0.0064)
Question 14(d)State the value and type of each expression.Math.sqrt(Math.pow(2.7, 2))
Question 14(e)State the value and type of each expression.Math.round(3.499)
Question 14(f)State the value and type of each expression.Math.max(1.5e-2, 0.095)
Question 14(g)State the value and type of each expression.Math.ceil(4.002)
Question 14(h)State the value and type of each expression.Math.min(-5, 1.0)
Question 14(i)State the value and type of each expression.Math.floor(7.99)
Question 14(j)State the value and type of each expression.Math.ceil(-2.73)
Question 14(k)State the value and type of each expression.Math.pow(16, 0.25)
Question 14(l)State the value and type of each expression.Math.pow(4, -2)
Question 14(m)State the value and type of each expression.Math.round(1.49 + 0.1)
Question 14(n)State the value and type of each expression.Math.round(1.49) + 0.1
Question 15(a)Write the following as Java expressions.a2−b2\sqrt{\text{a}^2 - \text{b}^2}a2−b2
Question 15(b)Write the following as Java expressions.π(x6 - y6)
Question 15(c)Write the following as Java expressions.43πr3\dfrac{4}{3} \pi r^334πr3
Question 15(d)Write the following as Java expressions.| z4 - 1 |
Question 16A student incorrectly attempted to produce a random value in the range 1.6 using the expression.6*(int)Math.random( ) + 1Correct the error...
Question 17What is the significance of a break statement in a switch statement ?
Question 18What are iteration statements ? Name the iteration statements provided by Java.
Question 19What is meant by an entry-controlled loop? Which Java loops are entry-controlled?
Question 20What is meant by an exit-controlled loop ? Which Java loops are exit-controlled ?
Question 21What is the difference between a while and do-while loop ?
Question 22How many times is the loop body executed in a do loop, even if the test-condition is false ?
Question 23What is nested loop ?
Question 24Write a program to print pattern like : 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1
Question 25Write a program to print a pattern as :1 2 3 4 5 1 2 3 4 1 2 3 1 2 1
Question 26Write a program to print a pattern as :1 1 0 1 0 1 1 0 1 0 1 0 1 0 1
Question 27Write a program to print a pattern as :* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Question 28Classify the following as primitive or non-primitive datatypes :chararraysintclasses
Question 29System.out.print("BEST"); System.out.println("OF LUCK"); Choose the correct option for the output of the above statements(i) BEST OF...
Question 30(a)Write a Java expression for the following :3x+x2a+b\dfrac{\sqrt{3x + x^2}}{a + b}a+b3x+x2
Question 30(b)What is the value of y after evaluating the expression given below ?y += ++y + y-- + --y ; when int y = 8
Question 30(c)Give the output of the following :Math.floor(-4.7)Math.ceil(3.4) + Math.pow(2,3)
Question 31What are the values stored in variables r1 and r2 ?double r1 = Math.abs(Math.min(-2.83, -5.83));double r2 = Math.sqrt(Math.floor(16.3));
Question 32(a)Name the operators listed below :<++&&? :
Question 32(b)State the number of bytes occupied by char and int data types.
Question 32(c)Write one difference between / and % operator.
Question 33Predict the output :class Test { public static void main (String args[]) { double x, y, z ; x = 3; y = 4;...
Question 34Predict the output :class Power { public static void main(String args[]) { int e = 5, result, i; result = 1 ;...
Question 35Predict the output :class FindFac { public static void main (String args[]) { for(int i = 2; i <= 100; i++) {...
Question 36Give the output of the following program segment and also mention how many times the loop is executed.int i; for (i = 5 ; i > 10; i++)...
Question 37Find the errorfor(count = 0, count < 5, count = count + 1) System.out.println("This is count:" + count);...
Question 38Find the error :x = 3; y = 4; z = math.power(x*x, y/2);
Question 39Find the error:class Test { public static void main (String args[]) { int x = 10; if(x == 10) { int y = 20;...
Question 40Write a program that inputs a number and tests if the given number is a multiple of both 3 and 5.import java.util.Scanner; public class...
Question 41Write a program that inputs a character and prints if the typed character is in uppercase or lowercase.import java.util.Scanner; public...
Question 42Write a program that inputs a character and prints if the user has typed a digit or an alphabet or a special character.import...
Question 43Write a program that inputs an alphabet and checks if the given alphabet is a vowel or not.import java.util.Scanner; public class...
Question 44Write a program that takes a number and check if the given number is a 3 digit number or not. (Use if to determine)import...
Question 45Write a program to input three numbers and print the largest of the three numbers.import java.util.Scanner; public class...
Question 46Write a program that takes a number and check if the given number is a 3 digit number or not. (Use a loop to determine)import...
Question 47Write a program that prints the squares of 10 even numbers in the range 10 .. 100.public class KboatSquares { public static void...
Question 48Write a program that inputs a number and checks if the given number is a palindrome. A number that is equal to its reversed number is a...
Question 49Write a program to input a number in the range 10 to 100 and check if it is a prime number.import java.util.Scanner; public class...
Question 50Write a program to print following series of numbers: 2, 5, 8, 11, 14....public class KboatSeries { public static void main(String...
Question 51Write a program to print Fibonacci series : 0, 1, 1, 2, 3, 5, 8....public class KboatFibonacci { public static void main(String...
Question 52Write a program to print factorial of a given number.import java.util.Scanner; public class KboatFactorial { public static void...
Question 53Write a program to print Floyd's triangle as shown below:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 import java.util.Scanner;...
Question 7ch += 2 is equivalent toch = ch + 2ch + 2ch =+ 2none of the above
Question 8The Math class is part of which Java library package.java.utiljava.iojava.randomjava.lang
Question 9Which clause is optional in a switch statement?switchcasedefaultnone of the above
Question 10Absence of which statement causes a fall-through in a switch statement.continuebreakstopfall