created: Feb 22, 2018


Quiz on BigInteger

Instructions: For each question, choose the single best answer. Make your choice by clicking on its button. You can change your answers at any time. When the quiz is graded, the correct answers will appear in the box after each question.


1. What is the approximate range of data type int?

A.    0 to 32 billion

B.    -32 billion to +32 billion

C.    -2 billion to +2 billion

D.    -2 million to +2 million

Correct Answer:


2. What is is called when the mathematically correct result is too large to fit into the number of bits of a data type?

A.    underflow

B.    overflow

C.    undertow

D.    overkill

Correct Answer:


3. Which of the following creates a BigInteger object containing the value 123?

A.    BigInteger a = new BigInteger( 123 );

B.    BigInteger a = new BigInteger( "123" );

C.    BigInteger a = 123 ;

D.    BigInteger a( 123 );

Correct Answer:


4. Which of the following arranges for val to point to a BigInteger holding the value 15.

A.    BigInteger val = BigInteger.ZERO ; val.add( 15 );

B.    BigInteger val = BigInteger.15 ;

C.    BigInteger val = BigInteger.ZERO ; val.add( new BigInteger( "15" ) )

D.    BigInteger val = BigInteger.ZERO ; val = val.add( new BigInteger( "15" ) )

Correct Answer:


5. What is the value held in val as a result of the following operations?

BigInteger val = BigInteger.ONE;

val = val.add( new BigInteger( "3" ) ).multiply( new BigInteger( "4" ) ) ;

A.    4

B.    8

C.    13

D.    16

Correct Answer:


6. What is the value held in val as a result of the following operations?

BigInteger val ;

val =  new BigInteger( "2" ) . add( new BigInteger( "3" ) ) . multiply( new BigInteger( "4" ));

A.    12

B.    14

C.    20

D.    24

Correct Answer:


7. Examine the following:

    BigInteger a = new BigInteger( "3" );
    BigInteger b = new BigInteger( "12" );
    BigInteger c = new BigInteger( "23" );
    BigInteger e = new BigInteger( "-7" );
    
    BigInteger r =  a.add( b ).negate().multiply( c ).add( e );

Which of the following expressions corresponds to the last statement?

A.    (-(a+b))*c + e

B.    (-a + b)*(c + e)

C.    -(a + b)*(c + e)

D.    (a - b)*c + e

Correct Answer:


8. What is printed by the following?

    BigInteger a = new BigInteger( "23" );
    BigInteger b = new BigInteger( "12" );
    BigInteger c = new BigInteger( "3" );
     
   System.out.println( a.divide(b).multiply(c) );

A.    6

B.    4

C.    3

D.    1

Correct Answer:


9. What is printed by the following?

    BigInteger a = new BigInteger( "23" );
    BigInteger b = new BigInteger( "12" );
    BigInteger c = new BigInteger( "3" );
     
   System.out.println( a.mod(b).multiply(c) );

A.    8

B.    3

C.    22

D.    33

Correct Answer:


10. What is printed by the following?

    BigInteger a = new BigInteger( "-18" );
    BigInteger m = new BigInteger( "5" );
      
    System.out.println( a.mod(m)  );

A.    -3

B.    3

C.    -2

D.    2

Correct Answer:


The number you got right:       Percent Correct:       Letter Grade:   


Click here If you have returned here from another page, or have re-loaded this page, you will need to click again on each of your choices for the grading program to work correctly. You may want to press the SHIFT KEY while clicking to clear the old answers.