import java.util.Stack;
public class Main
{
int a=1;
int b=2;
Main func(Main m){
Main m3=new Main();
m3=m;
m3.a=m.a++ + ++m.a;
m.b=m.b;
return m3;
}
public static void main (String [] args){
Main m1=new Main();
Main m2=m1.func(m1);
System.out.println("m1.a= "+m1.a+" m1.b= "+m1.b);
System.out.println("m2.a= "+m2.a+" m2.b= "+m2.b);
}
}
A) m1.a= 4 m1.b=2
m2.a= 1 m2.b=2
B) m1.a= 4 m1.b=2
m2.a= 4 m2.b=2
C) m1.a= 1 m1.b=2
m2.a= 4 m2.b=2
D) Compilation Error
public class Main
{
int a=1;
int b=2;
Main func(Main m){
Main m3=new Main();
m3=m;
m3.a=m.a++ + ++m.a;
m.b=m.b;
return m3;
}
public static void main (String [] args){
Main m1=new Main();
Main m2=m1.func(m1);
System.out.println("m1.a= "+m1.a+" m1.b= "+m1.b);
System.out.println("m2.a= "+m2.a+" m2.b= "+m2.b);
}
}
A) m1.a= 4 m1.b=2
m2.a= 1 m2.b=2
B) m1.a= 4 m1.b=2
m2.a= 4 m2.b=2
C) m1.a= 1 m1.b=2
m2.a= 4 m2.b=2
D) Compilation Error
import java.util.Stack;
public class Main
{
public static void main (String [] args){
int i=5;
while(i>0){
System.out.print(--i);
}
while(i<=5){
System.out.print(i++);
}
}
}
A) 54321012345
B) 43210-1012345
C) 43210012345
D) 432101234
public class Main
{
public static void main (String [] args){
int i=5;
while(i>0){
System.out.print(--i);
}
while(i<=5){
System.out.print(i++);
}
}
}
A) 54321012345
B) 43210-1012345
C) 43210012345
D) 432101234
import java.util.Arrays;
public class Main
{
public static void main (String [] args){
int[] array=new int[5];
for(int i=5;i>0;i--){
array[5-i]=i;
}
Arrays.fill(array,1,4,8);
for(int i=0;i<5;i++){
System.out.print(array[i]);
}
}
}
A) 58881
B) 12885
C) 54881
D) 12845
public class Main
{
public static void main (String [] args){
int[] array=new int[5];
for(int i=5;i>0;i--){
array[5-i]=i;
}
Arrays.fill(array,1,4,8);
for(int i=0;i<5;i++){
System.out.print(array[i]);
}
}
}
A) 58881
B) 12885
C) 54881
D) 12845
Which of the below is/are DevOp tool?
Anonymous Quiz
4%
Sumo logic
14%
Apache ActiveMQ
18%
OverOps
64%
All of the above
public class Program
{
void Program(){//Line 3 System.out.println("Program class initiated"); } public static void main(String[] args) { new Program(); } }
{
void Program(){//Line 3 System.out.println("Program class initiated"); } public static void main(String[] args) { new Program(); } }
Anonymous Quiz
21%
Program class initiated
32%
Compilation Error
11%
Exception at line 3
37%
Program executes and no output
public class Program
{
public static void main(String[] args) { int i= -3,j=2,k=0,m; m= ++i && ++j && ++k; System.out.println(i+" "+j+" "+" "+k+" "+m); } }
{
public static void main(String[] args) { int i= -3,j=2,k=0,m; m= ++i && ++j && ++k; System.out.println(i+" "+j+" "+" "+k+" "+m); } }
Anonymous Quiz
28%
-2 3 1 1
17%
2 3 1 2
56%
Compilation Error
0%
3 3 1 2
Which of the following is the correct order of evaluation for the below expression?
z = x + y * z / 4 % 2 - 1
z = x + y * z / 4 % 2 - 1
Anonymous Quiz
26%
* / % + - =
32%
= * / % + -
37%
/ * % - + =
5%
* % / - + =
Which data structure is used in elevator system (most optimal)?
Anonymous Quiz
25%
Stack
25%
Queue
33%
Tree
17%
Linked List
Python set to overtake Java in latest programming language rankings | ZDNet
https://www.zdnet.com/google-amp/article/python-set-to-overtake-java-in-latest-programming-language-rankings/
https://www.zdnet.com/google-amp/article/python-set-to-overtake-java-in-latest-programming-language-rankings/
ZDNet
Python set to overtake Java in latest programming language rankings | ZDNet
After 20 years at the top of the programming-language tree, Java looks set to be overtaken by Python.
which of the following is not valid input for switch statement?
Anonymous Quiz
17%
Int
37%
Long
3%
Char
43%
String
if(5>10)
System.out.println("fan");
else if(8!=9) System.out.println("glass"); else System.out.println("Cream");
System.out.println("fan");
else if(8!=9) System.out.println("glass"); else System.out.println("Cream");
Anonymous Quiz
9%
Fan
45%
Glass
23%
Cream
23%
None of the mentioned
final class A{
int i=1;
} class B extends A{ int j=1; void display(){ System.out.println(i+" "+j); } } public class Program { public static void main(String[] args) { B b=new B(); b.display(); } }
int i=1;
} class B extends A{ int j=1; void display(){ System.out.println(i+" "+j); } } public class Program { public static void main(String[] args) { B b=new B(); b.display(); } }
Anonymous Poll
18%
1 1
12%
0 1
18%
Runtime Error
53%
Compilation Error
public class Program
{
public static void main(String[] args) { int sum=9; double data=444.324; float value=5.1f; System.out.println(data+sum+value); } }
{
public static void main(String[] args) { int sum=9; double data=444.324; float value=5.1f; System.out.println(data+sum+value); } }
Anonymous Quiz
11%
444.32495.1
11%
456
63%
458.4239999046326
16%
458.4
when you want the system to execute a command you almost never have to give the full path to that how can it be achieved?
Anonymous Quiz
41%
PATH environment variable take care of this
24%
The SYSTEM_PATH environment variable take care of this
29%
The commands which declared under /usr/bin/ don't need to use full path
6%
This isn't correct,you don't have to specify the full path unless you are located under the command
which command will you choose to copy all files and sub directories?
Anonymous Quiz
54%
cp
8%
mv
29%
cp-R
8%
cp-A
class Program
{
public static void main(String[] args) {
try{
badMethod();
System.out.println("A");
}catch(RuntimeException ex){
System.out.println("B");
}catch(Exception ex1){
System.out.println("C");
}
finally{
System.out.println("D");
}
System.out.println("E");
}
public static void badMethod(){
throw new RuntimeException();
}
}
A) BD
B) BCD
C) BDE
D) BCDE
{
public static void main(String[] args) {
try{
badMethod();
System.out.println("A");
}catch(RuntimeException ex){
System.out.println("B");
}catch(Exception ex1){
System.out.println("C");
}
finally{
System.out.println("D");
}
System.out.println("E");
}
public static void badMethod(){
throw new RuntimeException();
}
}
A) BD
B) BCD
C) BDE
D) BCDE
public class Program implements Runnable
{
private String holdA="This is";
private int[] holdB={1,2,3,4,5,6,7,8,9,10};
public static void main(String[] args) {
Program p=new Program();//Line6
(new Thread(p)).start();//Line7
(new Thread(p)).start();//Line8
}
public synchronized void run()//Line10{
for(int w=0;w<10;w++){
System.out.println(holdA+holdB[w]+".");
}
}
}
A) Compilation fails because of an error on Line 6
B)Compilation fails because of an error on Line 10
C)Compilation fails because of an error on Line 7 and 8
D) Compilation succeeds and the program print each value.
{
private String holdA="This is";
private int[] holdB={1,2,3,4,5,6,7,8,9,10};
public static void main(String[] args) {
Program p=new Program();//Line6
(new Thread(p)).start();//Line7
(new Thread(p)).start();//Line8
}
public synchronized void run()//Line10{
for(int w=0;w<10;w++){
System.out.println(holdA+holdB[w]+".");
}
}
}
A) Compilation fails because of an error on Line 6
B)Compilation fails because of an error on Line 10
C)Compilation fails because of an error on Line 7 and 8
D) Compilation succeeds and the program print each value.