Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Java Quiz 19: Working With Boolean Variables

DZone's Guide to

Java Quiz 19: Working With Boolean Variables

Check out the answer to our most recent quiz about multi-dimensional arrays and test your Java knowledge when it comes to working with boolean variables.

· Java Zone ·
Free Resource

Learn how to build stream processing applications in Java-includes reference application. Brought to you in partnership with Hazelcast.

Before we start with this week's quiz, here is the answer to Java Quiz 18: Multidimensional Arrays.

The statement int[] array[][] is the same as int array[][][], and it declares a three-dimensional array.

The third element of the above mentioned array is {{6, 7, 8, 9, 10, 11}, {12, 13, 14, 15}, {16, 17, 18, 19}} starting with index 0.

The second array is {16, 17, 18, 19}, and the second element of this array is 18.

Therefore, the correct answer is: System.out.println(array[3][2][2]);  

Here Is the Java Quiz for Today!

What happens when the following program is compiled and run?

class MyClass
{
    public static void main(String args[])
    {
        int x = 3;
        boolean isDefect = false;
        do
        {
            x++;
            if(isDefect = true)
                System.out.print("A");
            else
                System.out.print("B");
        }
        while(x <= 5);
    }
}


Select the correct answer:

A. This program writes "BAA" to the standard output.

B. This program writes "ABB" to the standard output.

C. This program writes "BBB" to the standard output.

D. This program writes "AAA" to the standard output.

E. This program writes "BAB" to the standard output.

F. This program writes "ABA" to the standard output.

The correct answer and its explanation will be included in the next quiz in two weeks! For more Java quizzes, puzzles, and assignments, take a look at my site!

Learn how to build distributed stream processing applications in Java that elastically scale to meet demand- includes reference application.  Brought to you in partnership with Hazelcast.

Topics:
java ,multi-dimensional array ,boolean

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}