Contoh Soal Quiz Java dan JQuery [+Kunci Jawaban]

Defenisi Java dan JQuery

Sebelum kita melihat contoh soal quiz java dan JQuery, lebih baik kita mengenal dulu apa itu Java dan JQuery.



Java adalah bahasa pemrograman multi platform dan multi device.

Fungsionalitas dari Java ini dapat berjalan dengan platform yang berbeda karena sifatnya yang umum dan non-spesifik. dan saat ini Java adalah Bahasa Pemrograman yang terpopuler saat ini.

jQuery merupakab library JavaScript yang populer. Bahasa pemrograman ini dibuat oleh John Resig, pada tahun 2006, untuk memudahkan para developer dalam menggunakan dan menerapkan JavaScript di website.

 jQuery bukanlah bahasa pemrograman yang berdiri sendiri, melainkan bekerja sama dengan JavaScript. Dengan menggunakan jQuery, Anda bisa melakukan banyak hal.


Baiklah setelah tahu sedikit defenisi dari materi diatas, langsung saja kita lihat Contoh Soal Quiz Java dan JQuery. Jawaban yang benar diberi tanda cetak tebal ya (bold).

Java Quiz

1. What is a correct syntax to output "Hello World" in Java?
  • Console.WriteLine("Hello World"); 
  • print ("Hello World");
  • System.out.println("Hello World"); 
  • echo("Hello World");

2. Java is short for "JavaScript".
  • False
  • True

3. How do you insert COMMENTS in Java code?
  • // This is a comment
  • # This is a comment
  • /* This is a comment */

4. Which data type is used to create a variable that should store text?
  • Txt 
  • myString
  • String
  • string

5. How do you create a variable with the numeric value 5?
  • int x = 5;
  • x = 5;
  • float x = 5;
  • num x = 5

6. How do you create a variable with the floating number 2.8?
  • byte x = 2.8f 
  • int x = 2.8f;
  • float x = 2.8f;
  • x = 2.8f;

7. Which method can be used to find the length of a string?
  • getSize()
  • length() 
  • getLength()
  • len()

8. Which operator is used to add together two values?
  • The * sign 
  • The & sign
  • The + sign 

9. The value of a string variable can be surrounded by single quotes.
  • True 
  • False 

10. method can be used to return a string in upper case letters?
  • toUpperCase() Your answer
  • touppercase()
  • upperCase()
  • tuc()

11. Which operator can be used to compare two values?
  • ==
  • ><
  • =
  • <>

12. To declare an array in Java, define the variable type with:
  • {} 
  • [] 
  • ()

13. Array indexes start with:
  • 0  

14. How do you create a method in Java?
  • methodName[]
  • methodName()
  • (methodName)
  • methodName.

15. How do you call a method in Java?
  • methodName[]; 
  • (methodName);
  • methodName;
  • methodName()

16. Which keyword is used to create a class in Java?
  • class
  • class()
  • MyClass
  • className

17. What is the correct way to create an object called myObj of MyClass?
  • class myObj = new MyClass(); 
  • new myObj = MyClass();
  • MyClass myObj = new MyClass()
  • class MyClass = new myObj();

18. In Java, it is possible to inherit attributes and methods from one class to another.
  • True
  • False

19. Which method can be used to find the highest value of x and y?
  • Math.largest() 
  • Math.max()
  • Math.maxNum()
  • Math.maximum()

20. Which operator is used to multiply numbers?
  • #
  • *
  • x
  • %

21. Which keyword is used to import a package from the Java API library?
  • import
  • lib
  • package
  • getlib

22. How do you start writing an if statement in Java?
  • if x > y: 
  • if (x > y)
  • if x > y then:

23. How do you start writing a while loop in Java?
  • while (x > y)
  • while x > y {
  • while x > y:
  • x > y while {

24. Which keyword is used to return a value inside a method?
  • get
  • break
  • return
  • void

25. Which statement is used to stop a loop?
  • break
  • exit
  • stop
  • return

JQuery Quiz


1. Which of the following is correct?
  • jQuery is a JSON
  • jQuery is a JavaScript Library

2. jQuery uses CSS selectors to select elements?
  • True
  • False

3. Which sign does jQuery use as a shortcut for jQuery?
  • the $ sign
  • the % sign
  • the ? Sign

4. Look at the following selector: $("div"). What does it select?
  • The first div element 
  • All div elements 

5. Is jQuery a library for client scripting or server scripting?
  • Server scripting 
  • Client scripting 

6. Is it possible to use jQuery together with AJAX?
  • No
  • Yes 

7. The jQuery html() method works for both HTML and XML documents
  • True  
  • False 

8. What is the correct jQuery code to set the background color of all p elements to red?
  • $("p").layout("background-color","red"); 
  • $("p").css("background-color","red"); 
  • $("p").style("background-color","red");
  • $("p").manipulate("background-color","red");

9. With jQuery, look at the following selector: $("div.intro"). What does it select?
  • All div elements with id="intro" 
  • All div elements with class="intro" 
  • The first div element with id="intro"
  • The first div element with class="intro"

10. Which jQuery method is used to hide selected elements?
  • hide()
  • display(none)
  • hidden()
  • visible(false)

11. Which jQuery method is used to set one or more style properties for selected elements?
  • style()
  • css()
  • html()

12. Which jQuery method is used to perform an asynchronous HTTP request?
  • jQuery.ajaxSetup() 
  • jQuery.ajaxAsync()
  • jQuery.ajax() 

13. What is the correct jQuery code for making all div elements 100 pixels high?
  • $("div").yPos(100) 
  • $("div").height="100"
  • $("div").height(100)

14. Which statement is true?
  • To use jQuery, you can refer to a hosted jQuery library at Google 
  • To use jQuery, you must buy the jQuery library at www.jquery.com
  • To use jQuery, you do not have to do anything. Most browsers (Internet Explorer, Chrome, Firefox and Opera) have the jQuery library built in the browser

15. What scripting language is jQuery written in?
  • JavaScript
  • C++
  • VBScript
  • C#

16. Which jQuery function is used to prevent code from running, before the document is finished loading?
  • $(document).ready() 
  • $(body).onload()
  • $(document).load()

17. Which jQuery method should be used to deal with name conflicts?
  • nameConflict()  
  • noConflict()
  • conflict()
  • noNameConflict()

18. Which jQuery method is used to switch between adding/removing one or more classes (for CSS) from selected elements?
  • switchClass()
  • toggleClass()
  • switch()
  • altClass()

19. Look at the following selector: $("div p"). What does it select?
  • All div elements with a p element
  • The first p element inside a div element
  • All p elements inside a div element 

20. Is jQuery a W3C standard?
  • Yes
  • No

21. Look at the following selector: $("p#intro"). What does it select?
  • All p elements with class="intro"
  • The p element with id="intro"

22. Which jQuery method is used to remove selected elements?
  • Both methods can be used
  • detach()
  • remove()

23. Look at the following selector: $(":disabled"). What does it select?
  • All hidden elements
  • All elements that does not contain the text "disabled"
  • All disabled input elements
  • All elements containing the text "disabled"

24. Which jQuery method returns the direct parent element of the selected element?
  • parents()
  • ancestors()
  • parent()
  • ancestor()

25. The jQuery animate() method can be used to animate ANY CSS property?
  • Only properties containing numeric values
  • Yes
  • All properties except the shorthand properties

Akhir Kata

Itulah contoh soal quiz mengenai Java dan JQuery. semoga contoh soal quiz dan jawabannya tersebut dapan membantu kalian dalam menjawab soal dan menambah pengetahuan kalian. Terimakasih telah berkunjung, jangan lupa untuk selalu kunjungi fivser.com, sampai jumpa di artikel lainnya.