Chapter 3 Values and Data Types

 Chapter 3 

Values and Data Types

Question 1 ) Choose the correct option from the following. 

1) A _________ is the smallest element of a program that is meaningful to the compiler.

(a) Literal

(b) Token

(c) Variable

(d) Data

2) Literal are also known as ___________

(a) Tokens

(b) Identifiers

(c) Constants

(d) None of the above

3) There are _____ primitive data types in Java.

(a) 4

(b) 6

(c) 8

(d) 10

4) Boolean literals consist of the keywords; ______and _____

(a) true, false

(b) new, this

(c) do, while

(d) all of the above

5) Primitive data types are also known as

(a) Derived data types

(b) Reference data types

(c) User defined data types

(d) Intrinsic data types

6) The size of char data type is _______

(a) 2 bytes

(b) 4 bytes

(c) 6 bytes

(d) 8 bytes

7) The size of double data type is _______

(a) 2 bytes

(b) 4 bytes

(c) 6 bytes

(d) 8 bytes

8) Which of the following is / are valid escape sequences in Java

i ) \ n    ii) \t    iii) \?    iv) \p

(a) i) and ii)

(b) i) and iii)

(c) i) and iv)

(d) all of the above

9) Which of the following is / are valid identifier(s) in Java

i ) _new    ii) new   iii) New_    iv) 1new

(a) i) and ii)

(b) i) and iii)

(c) i) and iv)

(d) all of the above

10) Class variables are also known as ________

(a) Local variable

(b) Instance variable

(c) non static variable

(d) static variable

Question 2) State True Or False.

1) A character is written within double quotes.

(a) True

(b) False

2) \t is a special printing character used for printing horizontal tab

(a) True

(b) False

3) A string is enclosed in double quotes

(a) True

(b) False

4) Arrays and Objects are non-primitive data types in Java.

(a) True

(b) False

5) Identifiers mus be a keywords or boolean literal or null literal.

(a) True

(b) False

Question 3) Find odd one out.

1) 

(a) byte

(b) short

(c) int

(d) float

2) 

(a) int

(b) boolean

(c) String

(d) char

3) 

(a) \n

(b) \t

(c) \p

(d) \v

4)

(a) { }

(b) [ ]

(c) < >

(d) ( )

5) 

(a) Array

(b) Interface

(c) Class

(d) int