¡GoConqr estrena diseño! Cuéntanos qué te parece.

Test

Final Exam Computer Science Module 6

Christopher Castillo 3 preguntas

Hacer el test

Preguntas del test (3)

  1. 1Take a look at the below class specification and details of the student class. Which of the below methods represents a mutator method.
    Fields:
    * double GPA
    * String name
    Contructor:
    *Student ()
    Methods:
    * int getName()
    * void setName( String newName )
    * void resetGPA(): // sets GPA to 0.0
    1. AresetGPA
    2. BThere are no mutator methods
    3. CsetName
    4. DBoth resetGPA and setName are mutator methods
    5. EgetName
  2. 2What do accessor methods do?
    1. AAllow client code to add new class fields
    2. BAllow client code to access the values of class fields only
    3. CAllow the client to convert the class fields from public to private
    4. DAllow client code to modify the current values of the class fields
  3. 3Take a look at the below implementation of the Student class. Let's say you would like to a getter method. Which of the below choices would be considered a valid "getter" method?

    punlic class Student {
    private double GPA;
    private String name;
    public Student() {}
    public String getName() {
    return name;
    }
    public void setName(String newName) {
    name = newName;
    }
    public void resetGPA() {
    GPA= 0;
    }
    }
    1. Apublic double getGPA() {
      return this.GPA;
    2. Bpublic void getGPA() {
      System.out.printIn(this.GPA);
      }
    3. Cpublic void getGPA() {
      return this.GPA;
    4. Dpublic double getGPA() {
      this.GPA = GPA;
      }

Información

Descripción
Test sobre Final Exam Computer Science Module 6, creado por Christopher Castillo el 20/08/2024.
Idioma
English
Visitas
0
Etiquetas
acca
Valoración
Aún sin valoraciones
Valora este test
Valora este test

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?