Ics Practice Quiz 2 - Java

11 Questions | Total Attempts: 88

SettingsSettingsSettings
Java Quizzes & Trivia

Introduction to Computer Science practice java quiz


Questions and Answers
  • 1. 
    Explain what the following code will do.int h=0;while(h<10){        int i=0; while( i<4) { forward(50); right(90);                       i++; } h++;}
  • 2. 
    Write the code for making a triangle. You do not need to worry about the absolute correct angles. Just type in the basic drawing commands.
  • 3. 
    Create the code for making a circle. You must use one of the loop codes.
  • 4. 
    What will happen?The turtle starts at it's original position. A setPosition command is used and nothing else.
    • A. 

      The turtle will do nothing

    • B. 

      The turtle will move to the new position

    • C. 

      The turtle will draw a line to the new position

  • 5. 
    What will happen?for(int i=0; i<4; i++) { forward(50); right(90); }setDisplayColor(Color.blue);
    • A. 

      You will see a square with blue background.

    • B. 

      You will see four squares on a blue background.

    • C. 

      You will only see a blue background.

    • D. 

      Nothing will happen.

  • 6. 
    What does the following code create:forward(50);right(90);forward(100);right(90);forward(50);right(90);forward(100);
  • 7. 
    What is missing from the following code?int 1=0;while  i<45{forward(20);left(45);i++;}
  • 8. 
    Which of the following is correct
    • A. 

      SetpenColor(Color.blue)

    • B. 

      SetDisplay(Color.orange);

    • C. 

      SetDisplayColor(blue);

    • D. 

      SetPenColor(Color.gray);

  • 9. 
    Which of the following are the basic drawing commands?
    • A. 

      SetPenWidth(); forward(); backward(); right();

    • B. 

      Forward(); backward(); setHeading(); setPostion();

    • C. 

      Forward(); backward(); left(); right();

    • D. 

      SetPenColor(); backward(); right(); forward();

  • 10. 
    What does this create?penUp();forward(100);right(90);forward(50);right(90);forward(100);right(90);forward(50)
    • A. 

      A rectangle

    • B. 

      A square

    • C. 

      Some lines

    • D. 

      Nothing

  • 11. 
    What comes at the end of a command?
    • A. 

      Semi-colon

    • B. 

      Colon

    • C. 

      Curly bracket / brace

    • D. 

      Parentheses

Back to Top Back to top