Ajude a dar forma ao GoConqr. O que a gente deve adicionar?

Quiz

Java Week 5 Object Oriented Programming

Troy Bowlin 16 perguntas

Fazer o quiz

Perguntas do quiz (16)

  1. 1To declare a constant MAX_LENGTH as a member of the class, you write
    1. Afinal static MAX_LENGTH = 99.98
    2. Bfinal static float MAX_LENGTH = 99.98;
    3. Cstatic double MAX_LENGTH = 99.98
    4. Dfinal double MAX_LENGTH = 99.98
    5. Efinal static double MAX_LENGTH = 99.98
  2. 2What is the output of the following code:
    import java.util.Date;
    public class Test {
    public static void main (String[] args) [
    Date date1 = new Date();
    Date date2 = new Date();
    System.out.print((date1 == date2) + "" + (date1.getClass() == date2.getClass()));
    }
    }
    1. Afalse false
    2. Btrue true
    3. Cfalse true
    4. Dtrue false
  3. 3The abbreviation OOP stands for
    1. AObject Only Programming
    2. BObject Oriented Procedures
    3. CObject Oriented Programming
    4. DObject Only Programmers
  4. 4In the following code, what is the newStudent method called:
    public class newStudent{
    public String name;
    public int age;

    public newStudent(){
    age=5;
    name = "Jim Jones"
    }
    }
    1. Aobject
    2. Bconstructor
    3. Cgetter method
    4. Dsetter method
  5. 5Consider the following code, which output is correct?
    public class Student{
    int age;
    static int age2 = 3;

    public static void main (String[] args){
    Student student1;
    Student student2;
    Student student3;

    student1 = new Student();
    student1.age = 10;
    student2 = student1;
    student2.age -=5;
    student 3 = new Student();
    System.out.println(student1.age+:""+student2.age);
    }
    }
    1. A5 5
    2. B10 5
    3. C5 10
    4. D5 0
  6. 6In the following code what is the getName() method referred to:
    public class Student {
    public String name;
    public int age;
    public String getName(){
    return name;
    }
    public void setName(String newName){
    name = newName;
    }
    }
    1. Agetter method
    2. Bsetter method
    3. Cconstructor method
    4. Dinstance variable initialization
  7. 7A method that is associated with an individual object is called
    1. Astatic method
    2. Bclass method
    3. Can instance method
    4. Dan object method
  8. 8In the following code what is the setName() method referred to:
    public class Student{
    public String name;
    public int age;
    public String getName(){
    return name;
    }
    public void setName( String newName){
    name = newName;
    }
    }
    1. Asetter method
    2. Bgetter method
    3. Cconstructor method
    4. Dobject initialization
  9. 9What is the output of the following code?
    public class Test{
    public static void main (String[] args) {
    String s1 = new String ("Welcome to Java!");
    String s2 = new String("Welcome to Java!");
    if (s1==s2)
    System.out.println("s1 and s2 reference to the same String object");
    else
    System.out.println("s1 and s2 reference to different String objects");
    }
    }
    1. As1 and 2 reference to the same object
    2. Bs1 and s2 reference to difference String objects
  10. 10Which of the following code in A or B, or both creates an object of the java.util.Date class?
    A:
    public class Test{
    public Test(){
    new java.util.Date();
    }
    }
    B:
    public class Test {
    public Test(){
    java.util.Date date = new java.util.Date();
    }
    }
    1. AA
    2. BB
    3. CNeither
    4. DBoth

Informações

Descrição
AS - Level Computer Science (CS1102 Java) Quiz sobre Java Week 5 Object Oriented Programming , criado por Troy Bowlin em 02-10-2016.
Idioma
English
Visualizações
632
Etiquetas
computer scienceas leveljavaobject oriented programmingcs1102 javaas - level
Avaliação
Ainda sem avaliações
Avalie este quiz
Avalie este quiz

Fale Conosco

Sobre o que é sua mensagem?

O que a gente deve adicionar?