.
Semester-2 (Sample Questions)
JAVA
Java Standard Edition is used for server side programming.
A) True
B) False
Java Application & Java Applets are same.
A) True
B) False
The class name may not same with the java file name.
A) True
B) False
Java is an object oriented programming language.
A) True
B) False
Jump statements are the statements that transfer control from one part of the program to another part.
A) True
B) False
One of the important purposes of break statement is to exit from switch statement.
A) True
B) False
Non-primitive data types are derived from primitive data types.
A) True
B) False
For writing code in BlueJ editor we have to create a Project folder first.
A) True
B) False
Can we keep a different name for the java class name and java file name
A) True
B) False
What makes the Java platform independent?
A) Advanced programming language
B) It uses bytecode for execution
C) Class compilation
D) All of these
Which class in Java is used to take input from the user?
A) Scanner
B) Input
C) Applier
D) None of these
Method used to take a string as input in Java?
A) next()
B) nextLine()
C) Both A. and B.
D) None of these
Java is a high level programming language like _______
A) Basic
B) COBOL
C) C++
D) All of the above
IDE stands for:
A) Integration Development Environment
B) Integrated Development Environment
C) Internal Data Environment
D) None of these
Which is a java IDE?
A) Eclips
B) BlueJ
C) InteliJ IDEA
D) All of the above
The old name of java is :
A) C
B) OAK
C) JV
D) None of these
The important concepts of OOPs
A) Class
B) Methods
C) Objects
D) All of the above
Which of the following is a valid data types in Java?
A) Integer
B) Characters
C) Floating
D) All of these
+ is __________ operator.
A) Arithmetical
B) Bitwise
C) Logical
D) None of these
What is the size of float and double in java?
A) 32 and 64
B) 32 and 32
C) 64 and 32
D) 64 and 64
Decrement operator, ??, decreases the value of variable by what number?
A) 1
B) 2
C) 3
D) 4
What is the value stored in x in the following lines of Java code? int x, y, z; x = 0; y = 1; x = y = z = 8;
A) 0
B) 1
C) 9
D) 8
What will be the output of the following Java code? class operators {public static void main(String args[]){ int var1 = 5; int var2 = 6; int var3; var3 = (var2 * var1)/10;System.out.print(var3); } }
A) 6
B) 5
C) 30
D) 3
What will be the output of the following Java code?class Output { public static void main(String args[]){ int x=y=z=20;} }
A) compile and runs fine
B) run time error
C) 20
D) Compile time error
The 1st step of java programming is _______
A) Write the Java code
B) Create java file
C) Create the .class file
D) None of these
____ is the extension name of a Bytecode file.
A) . class
B) .java
C) .byte
D) .code
_________ is used to write the java codes.
A) DOS
B) MS word
C) BlueJ
D) All of these
______ is used to compile & Run the Java Program.
A) IDE
B) API
C) JVM
D) java
public static ________main.
A) String
B) void
C) Void
D) string
A___ describes all the properties of an object.
A) Class
B) object
C) program
D) java
Java is derived from______.
A) C
B) C++
C) .net
D) class
Which is used to develop a server side programs.
A) Java SE
B) Java EE
C) Java ME
D) None of these
The mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference.
A) Encapsulation
B) Object
C) Inheritance
D) Polymorphism
Which is key word in java?
A) while
B) int
C) static
D) All of these
Data types in java
A) int
B) float
C) char
D) All of these
What will be the output of the following programming code. public class rudra5{ public static void main(String args[]){ int a=20; int b=30; a=a+b; b=a-b; a=a-b; System.out.print(a); System.out.print(b);}}
A) 20 30
B) 30 20
C) 20 20
D) 30 30
A _______ statement allows us to execute a statement or group of statements multiple times.
A) Array
B) Function
C) loop
D) exception
Which loop guaranteed to execute at least one time?
A) for
B) do-while
C) while
D) All of the above
A ________ provides us with named storage that our programs can manipulate.
A) data type
B) constants
C) operators
D) variable
Choose a valid loop name in Java below.
A) For
B) While
C) Do-while
D) All of the above
To declare more than one variable of the specified type, we can use a __________ list.
A) colon-separated
B) bracket-separated
C) comma-separated
D) None of the above
How many kinds of variables in Java?
A) 2
B) 3
C) 4
D) 5
Which of the following is an Example of variable initialization?
A) int a, b, c;
B) int a = 10, b = 10;
C) int 10 = a;
D) None of the above
Which of the following is not a keyword in Java.
A) assert
B) boolean
C) abstract
D) finalize
Java was designed by ________.
A) Microsoft
B) Mozilla Corporation
C) Sun Microsystems
D) Amazon Inc.
