0% found this document useful (0 votes)
6 views3 pages

Test 4

The document contains a series of programming questions related to Java, focusing on command line arguments, integer operations, and bitwise operations. Each question is followed by multiple-choice answers, with the correct answers provided. The questions test knowledge of Java syntax, operators, and output behavior.

Uploaded by

Suresh G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Test 4

The document contains a series of programming questions related to Java, focusing on command line arguments, integer operations, and bitwise operations. Each question is followed by multiple-choice answers, with the correct answers provided. The questions test knowledge of Java syntax, operators, and output behavior.

Uploaded by

Suresh G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

1. what is the separator for the command line arguments?

a. space
b. comma
c. semicolon
d. hyphon

ans: a

2.
public class A {
public static void main(String[] args) {
int i = 1;
System.out.print(i++ + i++ + i);
System.out.println(i++ + i++);
}
}

a. 66
b. 67
c. 57
d. 56
e. 77

ans:b

3.
public class A {
public static void main(String[] args) {
int i = 1;
int j = i++ + i++ + i++ + i;
System.out.print(i++ + j++);
System.out.println(j++ + ++i);
}
}

a. 1317
b. 1416
c. 1418
d. 1517
e. 1417
f. 1518

ans:e

4.
public class A {
public static void main(String[] args) {
int i = 1;
i = i++;
System.out.print(i++);
System.out.println(i);
}
}

a. 13
b. 02
c. 01
d. 12
e. 23

ans:d

5.
public class A {
public static void main(String[] args) {
System.out.print(Integer.toBinaryString(123));
}
}

a. 1011011
b. 1101011
c. 1111111
d. 1111001
e. 1111011
f. 1111010

ans: e

6.
public class A {
public static void main(String[] args) {
System.out.print(Integer.parseInt("1010111101"));
}
}

a. 701
b. 704
c. 703
d. 709
e. 712
f. 1010111101

ans:f

7.
public class A {
public static void main(String[] args) {
System.out.print(123 | 33);
}
}

a. 183
b. 121
c. 124
d. 129
e. 323
f. 123

ans:f

8.
public class A {
public static void main(String[] args) {
System.out.print(123 & 33);
}
}
a. 23
b. 33
c. 31
d. 29
e. 323
f. 123

ans:b

9.
public class A {
public static void main(String[] args) {
System.out.print(123 ^ 33);
}
}

a. 23
b. 33
c. 31
d. 29
e. 90
f. 123

ans:e

10.
public class A {
public static void main(String[] args) {
System.out.print(123 >> 5 );
}
}

a. 0
b. 1
c. 2
d. 3
e. 4
f. 5
f. 8

ans:d

You might also like