Ics Practice Quiz 2 - Java

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Aishamo
A
Aishamo
Community Contributor
Quizzes Created: 3 | Total Attempts: 20,361
Questions: 11 | Attempts: 172

SettingsSettingsSettings
Ics Practice Quiz 2 - Java - Quiz


Introduction to Computer Science practice java quiz


Questions and Answers
  • 1. 

    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

    Correct Answer
    C. The turtle will draw a line to the new position
    Explanation
    The turtle will always leave a mark when it moves unless you use penUp() and penDwn().

    Rate this question:

  • 2. 

    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.

    Correct Answer
    C. You will only see a blue background.
    Explanation
    Since setDisplayColor came after the loop (that created a square) it places a block of color over whatever was drawn beforehand. You need to place setDisplayColor first.

    Rate this question:

  • 3. 

    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++;}

  • 4. 

    What does the following code create:forward(50);right(90);forward(100);right(90);forward(50);right(90);forward(100);

    Correct Answer
    rectangle
    a rectangle
    Explanation
    a rectangle

    Rate this question:

  • 5. 

    What is missing from the following code?int 1=0;while  i<45{forward(20);left(45);i++;}

    Correct Answer
    parentheses
    the opening and closing parentheses
    ()
    Explanation
    Its missing the parentheses around the while's true/false statement: while(i

    Rate this question:

  • 6. 

    Which of the following is correct

    • A.

      SetpenColor(Color.blue)

    • B.

      SetDisplay(Color.orange);

    • C.

      SetDisplayColor(blue);

    • D.

      SetPenColor(Color.gray);

    Correct Answer
    D. SetPenColor(Color.gray);
    Explanation
    A) the P in not capitalized
    B) Color is missing in setDisplayColor
    C) Color is missing in Color.blue

    Rate this question:

  • 7. 

    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();

    Correct Answer
    C. Forward(); backward(); left(); right();
    Explanation
    The basic drawing commands are the actions that allow the user to move the pen in different directions and change its position. The commands "forward()" and "backward()" are used to move the pen forward or backward, while "left()" and "right()" are used to rotate the pen in the respective directions. These commands are essential for creating different shapes and patterns in a drawing.

    Rate this question:

  • 8. 

    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

    Correct Answer
    D. Nothing
    Explanation
    The penUp makes the turtle not leave any marks

    Rate this question:

  • 9. 

    What comes at the end of a command?

    • A.

      Semi-colon

    • B.

      Colon

    • C.

      Curly bracket / brace

    • D.

      Parentheses

    Correct Answer
    A. Semi-colon
    Explanation
    every command ends with a semicolon

    Rate this question:

  • 10. 

    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.

  • 11. 

    Create the code for making a circle. You must use one of the loop codes.

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Apr 09, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Oct 15, 2009
    Quiz Created by
    Aishamo
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.