A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

1. Which of the following can be operands of arithmetic operators?
a. Numeric
b. Boolean
c. Characters
d. Both Numeric & Characters
View Answer Report Discuss Too Difficult!
Answer: (d).Both Numeric & Characters

2. Modulus operator, %, can be applied to which of these?
a. Integers
b. Floating – point numbers
c. Both Integers and floating – point numbers
d. None of the mentioned
View Answer Report Discuss Too Difficult!
Answer: (c).Both Integers and floating – point numbers

3. With x = 0, which of the following are legal lines of Java code for changing the value of x to 1?
1. x++;

2. x = x + 1;

3. x += 1;

4. x =+ 1;
a. 1, 2 & 3
b. 1 & 4
c. 1, 2, 3 & 4
d. 3 & 2
View Answer Report Discuss Too Difficult!
Answer: (c).1, 2, 3 & 4

4. Decrement operator, −−, decreases the value of variable by what number?
a. 1
b. 2
c. 3
d. 4
View Answer Report Discuss Too Difficult!
Answer: (a).1

5. Which of these statements are incorrect?
a. Assignment operators are more efficiently implemented by Java run-time system than their equivalent long forms
b. Assignment operators run faster than their equivalent long forms
c. Assignment operators can be used only with numeric and character data type
d. None of the mentioned
View Answer Report Discuss Too Difficult!
Answer: (d).None of the mentioned

6. What is the output of this program?
    class increment 
    {
        public static void main(String args[])
        {
            double var1 = 1 + 5; 
            double var2 = var1 / 4;
            int var3 = 1 + 5;
            int var4 = var3 / 4;
            System.out.print(var2 + " " + var4);
 
        } 
    }
a. 1 1
b. 0 1
c. 1.5 1
d. 1.5 1.0
View Answer Report Discuss Too Difficult!
Answer: (c).1.5 1

7. What is the output of this program?
    class Modulus 
    {
        public static void main(String args[]) 
        {    
             double a = 25.64;
             int  b = 25;
             a = a % 10;
             b = b % 10;
             System.out.println(a + " "  + b);
        } 
    }
a. 5.640000000000001 5
b. 5.640000000000001 5.0
c. 5 5
d. 5 5.640000000000001
View Answer Report Discuss Too Difficult!
Answer: (a).5.640000000000001 5

8. Which of these is not a bitwise operator?
a. &
b. &=
c. |=
d. <=
View Answer Report Discuss Too Difficult!
Answer: (d).<=

9. Which operator is used to invert all the digits in a binary representation of a number?
a. ~
b. <<<
c. >>>
d. ^
View Answer Report Discuss Too Difficult!
Answer: (a).~

10. On applying Left shift operator, <<, on integer bits are lost one they are shifted past which position bit?
a. 1
b. 32
c. 33
d. 31
View Answer Report Discuss Too Difficult!
Answer: (d).31

Page 1 of 11