THEORY PRACTICE TEST PAPER1

9
Created on By Baibhav Computer

THEORY PRACTICE TEST PAPER1

1 / 15

  1. What is a byte code?

2 / 15

2. State the differences between Syntax errors and Logical errors.

3 / 15

3. Write down the equivalent expression for the mathematical expression

q = 1 / √(a + b) + 3 / c2

4 / 15

4. Explain the methods print() and println()?

5 / 15

5. What do you mean by coercion?

6 / 15

6. What is the difference between these two function Math.ceil() and Math.rint(), explain with example.

7 / 15

7. Explain two types of jump statement in java.

8 / 15

8. Find the output: String s="Year 2019";

System.out.println(Character.isLetterOrDigit(s.charAt(5)));

System.out.println(Character.isWhitespace(s.charAt(4)));

System.out.println(Character.toLowerCase(s.charAt(3)));

 

9 / 15

9. Find the output: double x=12.35; int y=12;

String s1=String.valueOf(x);

String s2=Integer.toString(y);

System.out.println(s1+s2);

 

10 / 15

10. Find the output: int a = 0;

if(a>0 &&a<20)

a++;

else a--;

System.out.println(a);

11 / 15

11. Rewrite the following using switch-case.

char x;        int m=0;

if(x== ‘a’)

m=m+1;

if(x==’b’)

m=m+2;

12 / 15

12. State the output of:

for (int I = 1; i<=6; i++)

{

System.out.println(i+ “ “);

if(i%2==0)

continue;

System.out.println( i+ “ “);

 

}

13 / 15

13. Rewrite the following using for loop:

int i=1, f=1;

do{

f=f*I;

i++;

} while(i<=10);

System.out.println(f);

14 / 15

14. Rewrite using if-else:

comm = (sale> 15000)? Sale*  5/100:0;

15 / 15

15. Find the output:

char ch = 'y';

char chr = Character.toUpperCase(ch);

int p = (int) chr;

System.out.println(chr + "\t" + p);

 

Previous Post
Newer Post