Pre Test - 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,871
Pertanyaan: 19 | Attempts: 1,289

SettingsSettingsSettings
Pre Test - 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 provides the necessary runtime environment for executing Java applications. It includes the Java Virtual Machine (JVM), libraries, and other components required to run Java programs. JRE does not include the Java development tools or compiler, but it is sufficient for running already compiled Java programs. Therefore, JRE is the correct answer as it is essential for executing Java programs.

    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
    Perl is not a compiled programming language. It is an interpreted language, which means that the code is executed line by line without the need for compilation. In contrast, Java, C, and Pascal are all compiled programming languages, where the source code is compiled into machine code before execution.

    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 for mobile devices. J2ME (Java 2 Micro Edition) is a platform that provides a runtime environment for running Java applications on small devices with limited resources, such as mobile phones. It offers a set of APIs and libraries specifically designed for mobile development, allowing developers to create applications that are optimized for mobile devices. Therefore, J2ME is the best choice for developing a Java application that can be run on mobile devices.

    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, data type checking is performed during program compilation. This means that the compiler checks if the data types used in the program are compatible and consistent with the operations and assignments performed. Any errors or inconsistencies in the data types will be detected and reported during the compilation process. This ensures that the program is syntactically correct and helps prevent type-related errors during runtime.

    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 yang disebut Garbage Collector. Garbage Collector bertugas untuk secara otomatis menghapus pengalokasian memori yang sudah tidak digunakan oleh program. Hal ini dilakukan untuk mengoptimalkan penggunaan memori dan mencegah terjadinya kebocoran memori. Dengan adanya Garbage Collector, programmer tidak perlu secara manual menghapus objek yang sudah tidak digunakan, sehingga memudahkan dalam pengembangan program.

    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 dengan cara yang terstruktur dan terkontrol, 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 that allows for the creation of reusable software components. Notepad, Eclipse, and JCreator are all editors that can be used 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 statement "Method main() harus ada dalam setiap class program Java" is incorrect because the main() method is not required in every class in a Java program. The main() method is only required in the class that serves as the entry point for the program, typically named the "main" class. Other classes in the program may or may not have a main() method depending on their purpose.

    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 options are if, break, goto, and string. All of these options are keywords in Java except for the keyword "string". In Java, "string" is not a keyword, but it is a class that represents a sequence of characters. Keywords in Java have predefined meanings and cannot be used as identifiers, while "string" can be used as an identifier for variables, methods, or classes.

    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 given variable names "nim_mahasiswa", "$nilai", "NAMA", and "nilai-mhs" are all valid variable names in Java. However, "nilai-mhs" is not a valid variable name because it contains a hyphen, which is not allowed in variable names 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 double slashes (//) for single-line comments and using /* ... */ for multi-line comments. The other options mentioned (/* ... */ saja, #, and // saja) are not valid ways to write comments in Java.

    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 correct answer is "Object terdiri dari keyword dan method." This statement is incorrect because an object is an instance of a class and it consists of data (state) and behavior (methods), not just keywords and methods.

    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" because it is not a valid data type in Java.

    Rate this question:

  • 14. 

    Untuk menyimpan data nim mahasiswa, tipe data yang paling tepat digunakan adalah:

    • A.

      Numeric

    • B.

      String

    • C.

      Int

    • D.

      Float

    Correct Answer
    B. String
    Explanation
    The most appropriate data type to store student ID data is a string. Student ID numbers typically consist of a combination of numbers and letters, and can vary in length. Using a string data type allows for flexibility in storing and manipulating these values. Numeric data types such as int or float would not be suitable as they only allow for numerical values, while a string data type can accommodate alphanumeric characters.

    Rate this question:

  • 15. 

    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 juga sebagai operator modulus. Ketika operand pertama dibagi dengan operand kedua, operator modulus akan mengembalikan sisa hasil bagi dari pembagian tersebut.

    Rate this question:

  • 16. 

    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 a concept in object-oriented programming that allows a class to inherit or acquire properties and behaviors from another class. It enables code reusability and promotes the concept of hierarchy in programming. With inheritance, a class can inherit attributes and methods from a parent class, known as the superclass or base class. This allows the subclass or derived class to extend or modify the functionality of the superclass while inheriting its common characteristics. Inheritance facilitates code organization, improves code readability, and reduces code duplication.

    Rate this question:

  • 17. 

    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 tasks. In this case, the question is asking for the term that refers to the method that is automatically executed when an object of a class is created. The correct answer is "Constructor".

    Rate this question:

  • 18. 

    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 ketika terdapat beberapa method dengan nama yang sama tetapi memiliki parameter yang berbeda. Hal ini memungkinkan penggunaan yang lebih fleksibel dan memudahkan pemanggilan method dengan parameter yang sesuai dengan kebutuhan. Dengan adanya method overloading, kita dapat memiliki beberapa implementasi dari sebuah method dengan nama yang sama tetapi dengan fungsionalitas yang berbeda tergantung pada parameter yang diberikan.

    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 in Java. It is used to call the constructor, methods, and variables of the parent class from the child class. This allows the child class to inherit and utilize the functionality of 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 19, 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.