Ics Java Quiz 3

9 Questions | Attempts: 46
Share

SettingsSettingsSettings
Java Quizzes & Trivia

Intro to Computer Science Java quiz #2


Questions and Answers
  • 1. 

    A commands always ends with what?

    • A.

      Parenthesis

    • B.

      Semicolon

    • C.

      Curly bracket

    • D.

      Comma

    Correct Answer
    B. Semicolon
  • 2. 

    Which one is correct?

    • A.

      Setpencolor(red);

    • B.

      SetPenColor(red);

    • C.

      SetPenColor(color.red);

    • D.

      SetPenColor(Color.red);

    Correct Answer
    D. SetPenColor(Color.red);
  • 3. 

    Int x=15;setPenWidth(x);What is true

    • A.

      It loops 15 times

    • B.

      The turtle will have a x position of 15

    • C.

      The width of the turtles mark will be 15

    • D.

      There will be 15 boxes

    Correct Answer
    C. The width of the turtles mark will be 15
    Explanation
    The variable x is equal to 15 so whenever you see x it stands for 15. So setPenWidth(x); really means setPenWidth(15);

    Rate this question:

  • 4. 

    Int a=10;for (int b=0; b<10; b++){    forward (a);    right(90);    forward (a);    right(90);    forward (a);     right(90);     forward (a);     right(90);    a=a+20;}what is happening in this code? hint what changes each time the code loops

  • 5. 

    Fix the following code:private void runTurtle(){      setdisplaycolor ( new Color (255, 100, 0));      setPenWidth (5)      int x 0;      while (x<10);      {          square();          x++      }          private void square()      {          right(90);          forward(50);          right(90);          forward(50);          right(90);          forward(50);          right(90);          forward(50);       }}

  • 6. 

    What code captures the users answer?

    • A.

      Int user = Console.readInt();

    • B.

      Int user = console.readInt();

    • C.

      Int user = Console.println();

    • D.

      Int user = console.println();

    Correct Answer
    A. Int user = Console.readInt();
  • 7. 

    How will this be displayed in the console?Console.println ("Hello World");

    Correct Answer
    Hello World
  • 8. 

    How would you make a circle using a for loop?

  • 9. 

    The following error means what";" expected

    • A.

      A missing curly bracket

    • B.

      A missing parenthesis

    • C.

      A missing semi colon

    • D.

      Misspelled word

    Correct Answer
    C. A missing semi colon

Quiz Review Timeline +

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

  • Current Version
  • Mar 16, 2022
    Quiz Edited by
    ProProfs Editorial Team
  • Nov 03, 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.