Greenfoot Ch 1 Quiz

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 Tcarteronw
T
Tcarteronw
Community Contributor
Quizzes Created: 37 | Total Attempts: 30,952
Questions: 14 | Attempts: 2,633

SettingsSettingsSettings
Greenfoot Ch 1 Quiz - Quiz

Quiz over fundamental concepts in programming.


Questions and Answers
  • 1. 

    On the following picture "void setDirection(int direction)" is called  the  ____________________  of the method.

    • A.

      Object

    • B.

      Method

    • C.

      Instance

    • D.

      Signature

    Correct Answer
    D. Signature
    Explanation
    The term "signature" refers to the name and parameters of a method. In this case, "void setDirection(int direction)" is the signature of the method being called. It specifies the name of the method (setDirection) and the type and name of its parameter (int direction).

    Rate this question:

  • 2. 

    “Functions” are represented by Java methods whose returnType is not void.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    In Java, functions are represented by methods whose returnType is not void. This means that these methods return a value of a specific data type instead of nothing. The returnType specifies the type of value that the method will return when it is called. Therefore, the correct answer is true.

    Rate this question:

  • 3. 

    Void means the method does not return anything.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    The statement is true because in programming, a void method is a method that does not have a return type. It is used to perform a task or action without returning a value. When a method is declared as void, it means that it does not return any data back to the caller. Instead, it simply executes the code within the method and then terminates.

    Rate this question:

  • 4. 

    Methods that return a value are like questions.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Methods that return a value can be compared to questions because they allow us to ask the method for a specific value or information, just like we ask questions to get answers. When we call a method that returns a value, it executes its code and provides us with the result, similar to how a question provides us with an answer. Therefore, the statement "Methods that return a value are like questions" is true.

    Rate this question:

  • 5. 

    Methods that are void methods are like commands

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Void methods in programming are functions that do not return any value. They are used to perform certain actions or tasks, similar to giving commands. When a void method is called, it executes the code within it and completes the specified action without returning a result. Therefore, the statement that void methods are like commands is true, as they are used to perform actions rather than returning values.

    Rate this question:

  • 6. 

    A class called Ant extends the Actor class.

    • A.

      Ant is a super class to Actor

    • B.

      Actor is the super class to Ant

    • C.

      Actor is not a class

    Correct Answer
    B. Actor is the super class to Ant
    Explanation
    The correct answer is "Actor is the super class to Ant". This means that the class "Ant" inherits from the class "Actor". In object-oriented programming, a superclass is a class from which other classes are derived, while a subclass is a class that inherits properties and methods from a superclass. In this case, "Ant" is the subclass and "Actor" is the superclass. This relationship allows the "Ant" class to inherit and use the properties and methods defined in the "Actor" class.

    Rate this question:

  • 7. 

    To translate source code into machine code that a computer can understand and execute is called compiling.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Compiling is the process of converting source code, written in a high-level programming language, into machine code that can be understood and executed by a computer. This process involves various steps such as lexical analysis, syntax analysis, and code optimization. The resulting compiled code can then be run on the target computer architecture. Therefore, the given statement that translating source code into machine code is called compiling is correct.

    Rate this question:

  • 8. 

    What is the method name for the following method? public void eat()

    • A.

      Public

    • B.

      Voic

    • C.

      Eat()

    Correct Answer
    C. Eat()
    Explanation
    The method name for the given method is "eat()". This is determined by the combination of the access modifier "public", the return type "void", and the method name "eat()". The access modifier "public" indicates that the method can be accessed from anywhere. The return type "void" means that the method does not return any value. Finally, the method name itself is "eat()".

    Rate this question:

  • 9. 

    What is the return value of the following method?          public void setSize(int sze)

    • A.

      Public

    • B.

      Void

    • C.

      SetSize()

    • D.

      Int sze

    Correct Answer
    B. Void
    Explanation
    The return value of the given method is "void". This means that the method does not return any value. It is a type of method that performs a certain action or task, but does not produce a result that can be used or assigned to a variable. In this case, the method "setSize" takes an integer parameter "sze" and does some action with it, but it does not return any value.

    Rate this question:

  • 10. 

    The method below has one parameter. public void eat( )

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    zero

    Rate this question:

  • 11. 

    You want the dimensions of the world in your Greenfoot scenario to be 200 cells by 300 cells and each cell will be 5 by 5 pixels. Complete the statement below to accomplish this: (3 marks)

    • A.

      Super(200, 300, 5);

    • B.

      Super(300, 200, 5);

    • C.

      Super(200, 300, 5, 5);

    • D.

      Super(300, 200, 5, 5)

    Correct Answer
    A. Super(200, 300, 5);
    Explanation
    The correct answer is "super(200, 300, 5);" because the "super" keyword is used to call the constructor of the superclass, in this case, the World class. The parameters passed in the constructor are the width (200 cells), height (300 cells), and cell size (5 pixels). This statement sets the dimensions of the world in the Greenfoot scenario to be 200 cells by 300 cells, with each cell being 5 by 5 pixels.

    Rate this question:

  • 12. 

    Write the method call for the method signature. (How would you call the method in your code?) public void eat( )

    • A.

      Eat();

    • B.

      Eat;

    • C.

      Public void eat();

    Correct Answer
    A. Eat();
    Explanation
    The correct answer is "eat();". This is the correct method call for the method signature "public void eat()". The method call consists of the method name "eat" followed by parentheses "()". This syntax is used to invoke or call the method in your code.

    Rate this question:

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 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Sep 19, 2012
    Quiz Created by
    Tcarteronw
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.