Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

1) Which is a software which converts an assembly level language code to

machine level language code.


a. Compiler
b. Assembler
c. Interpreter
d. Loader
Answer: Assembler

2) Which is a software which converts high level language code to machine


level code.
a. Compiler
b. Assembler
c. Interpreter
d. Loader
Answer: Compiler

3) Which level language code is understandable by microprocessor?


a. High Level Language
b. Intermediate Level language
c. Binary code
d. Byte code
Answer: Binary code

4) Which level language code is human readable?


a. High Level Language
b. Intermediate Level language
c. Binary code
d. Byte code
Answer: High level language

1 Java | Rooman Technologies


5) What are the four expectations of the memory device?
a. Compact and non-volatile.
b. Volatile and speed
c. Speed
d. Cheep
Options:
I. a,b,c
II. b,c,d
III. a,c,d
IV. a,b,c,d
Answer: III- Compact and non-volatile, speed, cheep
6) Hard disk is made up of ___________, Ram is made up of __________.
a. Semiconductor technology, magnetic technology
b. Both are magnetic technology
c. Magnetic technology, Semiconductor technology
d. Both are Semiconductor technology.
Answer: Magnetic technology, Semiconductor technology

7) Anything which is executing will be present on ___________


a. Hard disk
b. Ram
c. Microprocessor
d. Rom
Answer: Ram

8) The memory space available on Ram is _________, Microprocessor is


_________ and Hard disk is ____________
a. File, Byte, Register
b. Byte, Register, File
c. Register, File, Byte
d. Register, Byte, File
Answer: Byte, Register, File

9) Why ram is considered to be a volatile device?


a. It needs continuous power supply.

2 Java | Rooman Technologies


b. Ram is compact in size.
c. Ram is directly connected to microprocessor
d. It doesn’t need continuous power supply.
Answer: It needs continuous power supply.

10) Ram stands for ___________ and Rom stands for


_______________
a. Random access memory, Read only memory
b. Read access memory, Random only memory
c. Random access management, Read only management
d. Read only memory, random access memory
Answer: Random access memory, Read only memory

3 Java | Rooman Technologies


1) What you meant by platform?
a. Platform is a combination of Hardware and software
b. Platform is a programming language
c. Platform is all the hardware devices
d. None of the above
Answer: Platform is a combination of Hardware and software
2) What is the difference between c compiler and java compiler?
a. Compiler is a software which converts MLL to HLL in c , HLL code
to byte code in java
b. Compiler is a software which converts HLL to MLL in c , HLL code
to byte code in java
c. Compiler is a software which converts HLL to MLL in c ,byte code to
HLL in java
d. Compiler is a Hardware device, byte code to HLL in java
Answer: Compiler is a software which converts HLL to MLL in c ,
HLL code to byte code in java
3) HLL code is also a _________ , MLL code is also a _________ , ILL
code is also a ________
a. Byte code, source code, Binary code
b. Source code, Byte code, Binary code
c. Binary code, Source code, Byte code
d. Source code, Binary code, Byte code
Answer: Source code, Binary code, Byte code

4) What is meant by platform dependency?


a. Platform of compilation and execution under same OS.
b. Platform of compilation under one OS and execution in different OS.
c. Both a&b.
d. None of the above.
Answer: Platform of compilation and execution under same OS.
5) What is JVM stands for _____________
a. Java virtual machine
b. Java volatile machine
c. Java virtual management

4 Java | Rooman Technologies


d. Java virtual memory
Answer: Java virtual machine

6) What is meant by platform Independency?


a. Platform of compilation and execution under same OS.
b. Platform of compilation under one OS and execution in different OS.
c. Both a&b.
d. None of the above.
Answer: Platform of compilation under one OS and execution in
different OS.

7) What is the flow of execution in java?


a. HLL – Byte code – MLL
b. MLL – Byte code – ILL
c. Byte code – HLL – MLL
d. None of the above
Answer: HLL – Byte code – MLL

8) Which is the preferred language which can be uploaded to internet?


a. HLL language
b. MLL language
c. Source code
d. Byte code
Answer: Byte code
Explanation: Byte code is preferred to be uploaded on internet because
of security reason as it is neither in high level nor in machine level
language so hacker cannot hack the code easily.
9) How java achieved platform independency?
a. Java provides different JVM’s for different OS
b. Java converts HLL to byte code which can be executed on different
OS using different JVM’s.
c. Both a & b.
d. None of the above

5 Java | Rooman Technologies


Answer: option c: Java provides different JVM’s for different OS
and Java converts HLL to byte code which can be executed on
different OS using different JVM’s.

10) Which is the software which is used to convert byte code to MLL?
a. JVM
b. Compiler
c. Assembler
d. Interpreter
Answer: JVM

6 Java | Rooman Technologies


1) Why java is relatively slow compared to c?
a. Due to Speed of execution
b. Due to platform independency
c. Due to Object orientation
d. All of the mentioned
Answer: All of the mentioned

2) Every object belongs to a _______


a. type
b. Method
c. Object
d. None of the mentioned
Answer: type
3) Which software is used for creating an object in java
a. Compiler
b. Assembler
c. JVM
d. Interpreter
Answer: JVM

4) How are object created in java


a. By using new keyword
b. By using class keyword
c. By using new method
d. None of the above
Answer: By using new keyword

5) How many objects can be created using a single class?


a. Only 1 object
b. No object can be created
c. N number of objects
d. 2 objects
Answer: N number of objects

7 Java | Rooman Technologies


6) How can we handle properties of an object
a. Using Data types
b. Using Methods
c. Using Class
d. Using Keywords
Answer: Using Data types
7) How can we handle behaviour of an object
a. Using Data types
b. Using Methods
c. Using Class
d. Using Keywords
Answer: Using Methods
8) Why object orientation is a good style of programming language?
a. Because it is close to real life
b. We can provide effective and efficient solution for real world problem
c. Both a & b
d. None of the above
Answer: Because it is close to real life and we can provide effective
and efficient solution for real world problem

9) How can we call a method present inside an object?


a. Using the class
b. Using the object reference
c. Directly it can be accessed
d. Object methods are not accessible
Answer: Using the object reference

10) How can we invoke JVM


a. By using new keyword
b. By using class keyword
c. By using new()
d. None of the above

Answer: By using new keyword


8 Java | Rooman Technologies
1) What is the return type of the main()?
a. public
b. static
c. void
d. String[] args
Answer: void

2) Can we have multiple main() within a class?


a. Yes
b. No
Answer: yes
Explanation: Yes provided the signature should be different
3) Which of these is a correct statement about args in the following line of
code?
public static void main(String args[])
a. args is a String
b. args is a Character
c. args is an array of String
d. args in an array of Character
Answer: args is an array of String

4) Is that compulsory to mention a String[] args when we don’t want to


pass the arguments during execution?
a. Yes
b. No
Answer: Yes

5) How many inputs can be passed through command line?


a. 1 integer input
b. N number of only integer inputs
c. N number of any inputs
d. N number of any inputs separated by space
Answer: N number of any inputs separated by space

9 Java | Rooman Technologies


6) What is the basic requirement that an OS expects from any programming
language?
a. main()
b. Class
c. String[] args
d. new
Answer: main()

7) What is the extension of java source file?


a. .java
b. .class
c. .jav
d. .c
Answer: .java

8) What is the extension of java Byte code?


a. .java
b. .class
c. .jav
d. .c
Answer: .class

9) What happens if we do not declare main() method has public?


a. Without any problem the program executes
b. Object cannot be created
c. The error message will be displayed as “main() not found”
d. Main() will not be visible to the OS
Options:
I. A&b
II. b, c, d
III. c, d
IV. a, c
Answer: option III - The error message will be displayed as
“main() not found” and Main() will not be visible to the OS

10 Java | Rooman Technologies


10) what is the convention followed by the methods in java
a. snake case
b. Camel case
c. Capital case
d. Small case
Answer: Camel case

11 Java | Rooman Technologies


1) What will be the output of the code given below?

a. 5,11,16
b. 6,12,18
c. 6,12,16
d. 5,12,16
Answer: 6, 12, 16
Explanation:
a=5
b = a++ + a-- = 5 + 6 = 11 after this line executes now a value is 5 and
b value is 11.
C = a ++ + b++ = 5 + 11 = 16 after this line executes c value is 16, b
value is 12 and a value is 6

2) What will be the output of the code given below?

12 Java | Rooman Technologies


a. 9,-2
b. 8,-2
c. 8,2
d. 9,2
Answer: 8, -2
Explanation:
a=5
a = a++ post increment means first assign the value then increment
the value finally a value is 5
a = ++a pre increment means first increment the value then assign
thus the final a value is 6
b = a++ - ++a = 6 – 8 = -2 thus final a value is 8 and b value is -2

3) What will be the output of the code given below?

a. 1
b. 5
c. 0
d. 2
Answer: 0
Explanation:
a=5
b=6
c = a++ - b-- + ++a - --a = 5 – 6 + 7 – 6 = 0 thus c value is 0.

13 Java | Rooman Technologies


4) What will be the output of the code given below?

a. 6
b. 8
c. 5
d. 7
Answer: 7
Explanation:
i=5
i++ now i value is 6
i = ++i = ++6 = 7 thus i value is 7

5) What will be the output of the code given below?

a. 8
b. 9
c. 7
d. 6
Answer: 8
Explanation:

14 Java | Rooman Technologies


i=5
i = i++ +1 = 5 + 1 = 6 now i value is 6
i = ++i + 1 = 7 + 1 = 8 now i value is 8

6) What will be the output of the code given below?

a.11,12
b.11,11
c.10,11
d.10,12
Answer: 11, 11
Explanation:
a = 10
b = ++a = ++10 = 11
b = a++ = 11++ = 11
Thus output of a and b is 11, 11.
7) What will be the output of the code given below?

a. 2,3,3

15 Java | Rooman Technologies


b. 3,4,4
c. 2,3,4
d. 3,3,4
Answer: 3, 4, 4
Explanation:
a=1
b=2
c = ++b = ++2 = 3 now b value is 3 and c value is also 3
d = a++ = 1++ = 1 now a value is 2 and d value is 1
c++ = 3++ ,now c value is 4
b++ = 3++ , now b value is 4
++a = ++2 , now a value is 3

8) What is the output for the following program?

a. 1
b. 0
c. Error
d. None of the above
Answer: 1
Explanation:
P = --m * --n * n-- * m—
= --0 * --0 * -1 -- * -1—
=1

16 Java | Rooman Technologies


9) What will be the output of the code given bellow?

a. 6
b. 4
c. 5
d. 7
Answer: 5
Explanation:
a = a++ + ++a * --a – a --
=1+3*2–2
= 1 + 6 – 2 = 7 -2 = 5
Thus the output of above code is 5

10) What will be the output of the code given bellow?

a. Error
b. 0
c. 1
d. 2
Answer: 0
Explanation:
m++ / ++n * n-- / --m = 10 /11*11 / 10 = 0*11/10 = 0/10 = 0
m and n are declared as integers so decimal points are not
considered.

17 Java | Rooman Technologies


11) What will be the output of the code given bellow?

a. 12
b. 11
c. Error
d. None of the above
Answer: Error
Explanation:
a = 10
b = ++(++10) this is an unexpected type so you will get error.

12) What is the output for the following program?

a. Error
b. 12
c. 11
d. 14
Answer: Error
Explanation: You should not use numeric before operator so you
will get error

18 Java | Rooman Technologies


13) What is the output for the below code?

a. sum = 265
b. sum = 263
c. sum = 264
d. Error
Answer: b
Explanation:
c = a++ + ++b = 34 + 22 = 56 , now a = 35, b = 22
d = --a + --b + c-- = 34 + 21 + 56 = 111, now a = 34, b = 21, c = 55
and d = 111
e = a + +b + +c + d-- = 34 + (+21) + (+55) + 111 = 221 , now a = 34,
b= 21, c = 55, d = 110 and e = 221
f = -a + b-- + -c – d++ = -34 + 21 + (-55) – 110 =-178, now a = 34,
b= 20, c = 55, d = 111, e = 221 and f = -178
sum = 34 + 20 + 55 + 111 + 221 – 178 = 263

14) What will be the output of following program?

19 Java | Rooman Technologies


a. 25
b. 24
c. 32
d. 33
Answer: 32
Explanation:
g=3
++g * 8 = 4* 8 = 32
15) What will be the output of following program?

a. Error
b. 0,1,2,3,4
c. Infinite loop
d. None of the above
Answer: c
Explanation:
In the above the j value is not decrementing and incrementing so j
value remains 0 and here we are checking the condition whether
j< 5 which will be true always so it will enters infinite loop and
keeps printing the value 0.

20 Java | Rooman Technologies


21 Java | Rooman Technologies

You might also like