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

1.

In "println()" curser moves to a new line after printing the line and in "print()" curser just moves to
next point after printing.

2.
3. There are 5 leterals in java.

· Integer literal

· Floating literals

· Character literals

· Boolean literals
· String literals

4.
5.

6.
7.

8.
9.

10.

11.
12.

13.
14. Answe : d

Because, to print the variable, it must be "innitialized" first.

15.Answer: c

program is to print two variables. So, for that two variables should be declared and innitialized in the
same line.

16. A

BCD

EF
G

17. 60

10+20+30

10+2030

102030

102030

3030

102030

18. Line 1 - binary number (prints 228)

Line 2 - this is same as line 1. 'B' can be "capital " or "simple" (prints 228)

Line 4 - octal number converts to decimal number (prints 100)

Line 6 - hexadecimal number converts to decimal number (prints 100)

Line 7 - hexadecimal number converts to decimal number (prints 2748)

Line 8 - hexadecimal number converts to decimal number (prints 43981)

Line 10 - hexadecimal number converts to decimal number (prints 268435455)

19.
20.

class Quiz20{

public static void main(String args[]){

System.out.print("java is a typed language\nAB" + "\"CB\nAB" + "\\CD\nC:\\Windows\\


Program\nAB\\" + '"' + "CD\nAB\\\\" + '"' + '"' + "CD\nAB\\" + "nCD\nAB\\" + "tCD\nAB\\" + "bCD");

21. b

to print the variable x, it should be innitialized first.

22.
23. 10

20

30

200

24.

25.

26.
27. d

28. a, c

29. e

30. e

31. d

32. a

33. 6 (adding three integers)

123 (String Concatenation)

123 (Concatenates characters to characters)

1 2 3 (Concatenates characters to strings)

ABC (Concatenates characters to characters)

ABC (String Concatenation)

A B C (Concatenates characters to strings)


34. a converts binary to decimal

d converts octal to decimal

e converts hexadecimal to decimal

x converts octal to decimal

You might also like