- Which of the following is true?
- Java uses only interpreter
- Java uses only compiler
- Java uses both interpreter and compiler:
- None of the above.
- A Java file with extension .class contains
- Java source code
- HTML tags
- Java Byte code
- A program file written in Java programming language
- Which of the following features are not common in both Java and C++
- The class declaration
- The access modifiers
- The encapsulation of data and methods.
- Multiple inheritance from class
- What is the value returned by the method f () defined below:
public static int f(int x, int y) { return (x> y) ? y: x; }
- The sum of and y that is, x + y
- The difference of x and y that is, x- y
- The maximum of x and y that is, the larger value of x and y
- The minimum of x and y that is the smaller value of x and y.
- A platform is the hardware or software environment in which a program runs. Which of the following is are Java platform component(s)?
- HTML
- Java Virtual Machine
- Java Application Programming Interface (API)
- Hot Java
- Consider the following program.
public class Question 1 {
public static void main (String args[]){
for (int a=l;a<3 a+=3)
System.out.println (--a) :
}
}
What will be the output of the program if it is executed?
3>- 0
- 01
- 012
- 0123
- Following is a piece of code where some parts of a statement is missing
public class Question 3 {
public static void main (String args[]){
char arr[]=('a', 'b','c', 'd','e'};
System.out.println (-------------);
}
}
You have to choose the correct option for the argument in System.out.print() function to print the first and the last characters in the array arr.- arr[arr.length-1] + arr[o]
- arr [0] + arr[arr.length-1]
- +arr[0] + arr[arr.length-1]
- a + arr[arr.length-1]+ arr
- Which of the following cannot be used for a variable name in Java?
- identifier
- final
- malloc
- calloc
-
public class Operator {
public static void main(String args){
String stl="NAGA";
String str2="RAJU";
System.out.println (strl+str2); //Statement 1
int a=20;
int b=10;
System.out.println(a+b);
//Statement 2
}
}
- Except + (plus) operator all other operators are overloaded in java
- NAGARAJU
- 1020
- 30
- Which of the following is an incorrect array declaration?
- int[] a = new int[20];
- int [] a;
- int[][] a = new int[20];
- int[][] a = {(1, 2, 4), (1, 2, 4)}
JAVA MCQs-1
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment