Pre Quiz Pemrograman Berorientasi Obyek (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 Achmatim
A
Achmatim
Community Contributor
Quizzes Created: 2 | Total Attempts: 1,861
Pertanyaan: 19 | Attempts: 580

SettingsSettingsSettings
Pre Quiz Pemrograman Berorientasi Obyek (Java) - Quiz

Pre Test - Pemrograman Berorientasi Obyek (Java) untuk kelompok KU Semester Gasal 2008/2009.Kerjakan sesuai dengan kemampuan Anda masing-masing. Hasil yang diperoleh tidak akan berpengaruh terhadap nilai Anda.


Questions and Answers
  • 1. 

    Untuk menjalankan program Java, komputer harus terinstall:

    • A.

      J2SDK

    • B.

      JRE

    • C.

      J2ME

    • D.

      Java Compiler

    Correct Answer
    B. JRE
    Explanation
    To run a Java program, the computer must have JRE (Java Runtime Environment) installed. JRE is responsible for executing Java applications and provides the necessary runtime environment. It includes the Java Virtual Machine (JVM) and other libraries and components required to run Java programs. JRE does not include the Java development tools like the Java Compiler (JDK) or J2SDK (Java 2 Software Development Kit). Therefore, JRE is the correct answer as it is specifically designed for running Java applications.

    Rate this question:

  • 2. 

    Berikut ini merupakan jenis bahasa program yang berbasis compiler (compiled programming), kecuali:

    • A.

      Java

    • B.

      C

    • C.

      Perl

    • D.

      Pascal

    Correct Answer
    C. Perl
    Explanation
    The given options consist of programming languages that are based on compilers, except for Perl. Java, C, and Pascal are all compiled programming languages that require a compiler to convert the source code into machine code or bytecode. However, Perl is an interpreted programming language, which means it does not need to be compiled before execution. Instead, the Perl interpreter reads and executes the code directly. Therefore, Perl is the correct answer as it is not a compiled programming language.

    Rate this question:

  • 3. 

    Jika ingin membuat aplikasi Java untuk dijalankan di perangkat mobile, maka paling tepat menggunakan:

    • A.

      J2SDK

    • B.

      J2ME

    • C.

      Applet

    • D.

      Servlet

    Correct Answer
    B. J2ME
    Explanation
    J2ME is the most appropriate option for developing a Java application to run on mobile devices. J2ME, or Java 2 Micro Edition, is specifically designed for resource-constrained devices like mobile phones. It provides a platform for developing applications that can run efficiently on mobile devices with limited processing power, memory, and display capabilities. J2SDK, Applet, and Servlet are not specifically designed for mobile devices and may not provide the necessary features and optimizations required for mobile application development.

    Rate this question:

  • 4. 

    Pengecekan tipe data di Java dilakukan saat:

    • A.

      Program dikompilasi.

    • B.

      Program dijalankan pertama kali.

    • C.

      Setiap kalo program dijalankan.

    • D.

      Semua benar.

    Correct Answer
    A. Program dikompilasi.
    Explanation
    In Java, type checking is performed during the compilation of a program. This means that any errors or mismatches in the types of variables or expressions will be detected and reported by the compiler before the program is executed. This helps to ensure that the program is syntactically correct and reduces the likelihood of runtime errors related to type mismatches. Therefore, the correct answer is "Program dikompilasi."

    Rate this question:

  • 5. 

    Secara otomatis Java akan menghapus pengalokasian memory yang sudah tidak digunakan dengan proses yang disebut:

    • A.

      Exception handling

    • B.

      Memory handling

    • C.

      Destructor

    • D.

      Garbage collector

    Correct Answer
    D. Garbage collector
    Explanation
    Java memiliki mekanisme pengelolaan memori otomatis yang disebut "garbage collector". Garbage collector bertugas untuk menghapus atau membebaskan memori yang tidak lagi digunakan oleh program. Proses ini dilakukan secara otomatis oleh Java, sehingga pengguna tidak perlu secara manual menghapus memori yang tidak digunakan. Dengan adanya garbage collector, program Java menjadi lebih efisien dalam penggunaan memori dan mencegah terjadinya memory leak.

    Rate this question:

  • 6. 

    Fitur di Java yang memungkinkan programmer mengatur penanganan error yang terjadi dalam program, disebut:

    • A.

      Exception handling

    • B.

      Memory handling

    • C.

      Destructor

    • D.

      Garbage collector

    Correct Answer
    A. Exception handling
    Explanation
    Exception handling adalah fitur di Java yang memungkinkan programmer untuk mengatur penanganan error yang terjadi dalam program. Dengan menggunakan exception handling, programmer dapat menangani dan mengelola error secara terstruktur, sehingga program dapat tetap berjalan dengan baik meskipun terjadi error.

    Rate this question:

  • 7. 

    Berikut ini editor yang dapat digunakan untuk menuliskan program Java, kecuali:

    • A.

      Notepad

    • B.

      Eclipse

    • C.

      JCreator

    • D.

      JavaBeans

    Correct Answer
    D. JavaBeans
    Explanation
    JavaBeans is not an editor that can be used to write Java programs. It is a software component model for Java, used to create reusable components. It provides a set of guidelines for creating Java classes that can be easily integrated into different development environments. Therefore, JavaBeans is not a valid option for an editor to write Java programs.

    Rate this question:

  • 8. 

    Pernyataan yang benar berhubungan dengan program Java, kecuali:

    • A.

      Setiap program Java minimal terdapat satu buah class.

    • B.

      Method main() harus ada dalam setiap class program Java

    • C.

      Setiap statement program Java harus diakhiri dengan titik-koma (;)

    • D.

      Java bersifat case-sensitive.

    Correct Answer
    B. Method main() harus ada dalam setiap class program Java
    Explanation
    The correct answer is "Method main() harus ada dalam setiap class program Java". This statement is incorrect because it is not necessary for every class in a Java program to have a main() method. The main() method is only required in the class that serves as the entry point for the program. Other classes can be created without a main() method.

    Rate this question:

  • 9. 

    Berikut ini merupakan keyword yang terdapat dalam Java, kecuali:

    • A.

      If

    • B.

      Break

    • C.

      Goto

    • D.

      String

    Correct Answer
    D. String
    Explanation
    The given keywords are "if", "break", and "goto". These are all valid keywords in the Java programming language. However, "string" is not a keyword in Java. It is a class that represents a sequence of characters and is used to manipulate strings in Java.

    Rate this question:

  • 10. 

    Berikut ini merupakan penamaan variabel yang benar dalam Java, kecuali:

    • A.

      Nim_mahasiswa

    • B.

      $nilai

    • C.

      NAMA

    • D.

      Nilai-mhs

    Correct Answer
    D. Nilai-mhs
    Explanation
    The variable "nilai-mhs" is not a correct variable name in Java because it contains a hyphen ("-"). In Java, variable names cannot contain special characters like hyphens. Variable names can only consist of letters, numbers, and underscores. Therefore, "nilai-mhs" is not a valid variable name in Java.

    Rate this question:

  • 11. 

    Komentar program dalam Java dapat menggunakan perintah:

    • A.

      // saja

    • B.

      /* … */ saja

    • C.

      // dan /* … */

    • D.

      #, // dan /* … */

    Correct Answer
    C. // dan /* … */
    Explanation
    The correct answer is "// dan /* ... */" because in Java, comments can be written using the double forward slash (//) for single-line comments and the forward slash and asterisk (/* ... */) for multi-line comments.

    Rate this question:

  • 12. 

    Berikut ini pernyataan yang benar berhubungan dengan class dan object dalam Java, kecuali:

    • A.

      Class merupakan pendefinisian dari object.

    • B.

      Object merupakan instance dari class.

    • C.

      Object terdiri dari keyword dan method.

    • D.

      Setiap class dapat mengandung beberapa method sekaligus.

    Correct Answer
    C. Object terdiri dari keyword dan method.
    Explanation
    The given statement "Object terdiri dari keyword dan method" is incorrect. Objects in Java do not consist of keywords and methods. Objects are instances of classes and they have state (data) and behavior (methods). The statement is incorrect because it implies that objects are composed of keywords and methods, which is not true.

    Rate this question:

  • 13. 

    Berikut ini merupakan tipe data dasar dalam Java, kecuali:

    • A.

      Long

    • B.

      Int

    • C.

      String

    • D.

      Float

    Correct Answer
    C. String
    Explanation
    The given options represent different data types in Java. "long", "int", and "float" are all valid data types in Java. However, "string" is not a valid data type in Java. The correct data type for representing textual data in Java is "String" (with a capital "S"). Therefore, the correct answer is "string".

    Rate this question:

  • 14. 

    Salah satu operator aritmatika yang akan menghasilkan sisa hasil bagi dari 2 operand, yaitu:

    • A.

      +

    • B.

      /

    • C.

      *

    • D.

      %

    Correct Answer
    D. %
    Explanation
    Operator aritmatika yang akan menghasilkan sisa hasil bagi dari 2 operand adalah %. Operator ini disebut modulo atau modulus. Ketika operand pertama dibagi dengan operand kedua, operator % akan mengembalikan sisa hasil bagi dari operasi tersebut. Misalnya, jika operand pertama adalah 7 dan operand kedua adalah 3, maka hasilnya adalah 1 karena 7 dibagi dengan 3 menghasilkan sisa 1.

    Rate this question:

  • 15. 

    Konsep OOP yang memungkinkan suatu class dapat menurunkan sifat ke class lain, adalah:

    • A.

      Encapsulation

    • B.

      Inheritance

    • C.

      Exception

    • D.

      Polymorphisme

    Correct Answer
    B. Inheritance
    Explanation
    Inheritance is the OOP concept that allows a class to inherit or acquire the properties and behaviors of another class. It enables code reusability and promotes the hierarchical organization of classes. Inheritance allows a class to inherit the attributes and methods of another class, known as the parent or base class, and also allows the derived class to add its own unique attributes and methods. This concept facilitates the creation of more specialized classes based on existing ones, promoting code efficiency and modularity.

    Rate this question:

  • 16. 

    Suatu method yang akan dijalankan otomatis saat object dari class dibuat, dikenal dengan:

    • A.

      Inheritance

    • B.

      Garbage Collector

    • C.

      Constructor

    • D.

      Initializer

    Correct Answer
    C. Constructor
    Explanation
    A constructor is a special method that is automatically executed when an object of a class is created. It is used to initialize the object's state and perform any necessary setup operations. In this case, the correct answer is "Constructor" because it is the method that is executed automatically when an object is created.

    Rate this question:

  • 17. 

    Apa yang dimaksud dengan method overloading?

    • A.

      Method-method yang memiliki nama sama tetapi dengan parameter yang berbeda.

    • B.

      Method yang memiliki nama sama tetapi type yang berbeda.

    • C.

      Method yang akan dijalankan otomatis saat object diciptakan.

    • D.

      Method yang tidak memiliki nilai keluaran (return value)

    Correct Answer
    A. Method-method yang memiliki nama sama tetapi dengan parameter yang berbeda.
    Explanation
    Method overloading adalah konsep dalam pemrograman dimana terdapat beberapa method dengan nama yang sama, tetapi memiliki parameter yang berbeda. Dengan menggunakan method overloading, kita dapat memiliki beberapa versi dari method yang berbeda dalam hal parameter yang diterima. Hal ini memungkinkan kita untuk menggunakan method yang sama dengan cara yang berbeda tergantung pada tipe atau jumlah parameter yang kita berikan saat memanggil method tersebut.

    Rate this question:

  • 18. 

    Jika suatu method dideklarasikan sebagai protected, maka:

    • A.

      Method hanya dapat diakses oleh class method berada.

    • B.

      Method hanya dapat diakses oleh class turunannya.

    • C.

      Method dapat diakses oleh class dimana method berada dan class turunannya.

    • D.

      Method dapat diakses oleh semua class.

    Correct Answer
    C. Method dapat diakses oleh class dimana method berada dan class turunannya.
    Explanation
    When a method is declared as protected, it can be accessed by the class where the method is located and its subclasses. This means that any class that extends the class where the protected method is declared can access and use that method. However, classes that are not subclasses of the class where the protected method is declared cannot access or use the method.

    Rate this question:

  • 19. 

    Untuk mengakses class atas (parent class) dapat menggunakan keyword:

    • A.

      Parent

    • B.

      Super

    • C.

      This

    • D.

      Extends

    Correct Answer
    B. Super
    Explanation
    The keyword "super" is used to access the parent class. It is used when there is a need to refer to a method or variable from the parent class within the child class. By using "super", the child class can access and utilize the methods and variables defined in the parent class.

    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 20, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Aug 31, 2008
    Quiz Created by
    Achmatim
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.