I wrote this simple multiply choice trivia quiz using Java programming language that shows how to use control statements, arrays, and methods in Java.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Program Listing

 * @author Jake Rodriguez Pomperada, MAED-IT, MIT
 * jakerpomperada@gmail.com
 * www.jakerpomperada.com  / www.jakerpomperada.blogspot.com
 * Bacolod City, Negros Occidental, Philippines
 * January 25, 2021  Monday

import java.util.Scanner;

public class Multiple_Choice_Quiz {    
 static Scanner Input = new Scanner(System.in);
 public static void display_program() {
	   int correct = 0;

       int incorrect=0;

      int questions = 5;

      System.out.println("Multiple Choice Trivia Quiz in Java");


       String[][] Ques_Ans = {

{"What game was created by Markus Persson in the Java programming language?","\n A. Pacman \n B. Minecraft \n C. Starcraft \n D. Battle City\n","B"},

{"What nba team Lebron James wins his 4th Championship ring? ","\n A. Chicago Bulls \n B. New York Knicks \n C. LA Lakers \n D. Boston Celtics\n","C"},

{"Who is the present President of the Philippines? ","\n A. Gloria Arroyo \n B. Rody Duterte \n C. Fidel Ramos \n D. Noynoy Aquino\n","B"},

{"Who is the founder of Microsoft? ","\n A. Bill Allen \n B. Peter Norton \n C. Bill Gates \n D. Mark Cuban\n","C"},

{"What NBA Team Tim Duncan played?","\n A. San Antonio Spurs \n B. Toronto Raptors \n C. Detriot Piston \n D. Booklyn Nets\n","A"}};

      String[] user_ans = new String[(int) questions];

      int i=0;


      do {

          System.out.print("" + (i+1) + ". " + Ques_Ans[i][0] + "   "+Ques_Ans[i][1]);

          user_ans[i] = String.valueOf(Input.next().charAt(0));

          if(Ques_Ans[i][2].equals(user_ans[i].toUpperCase())) {

              System.out.println("\n Correct Answer!");





              System.out.println("\n Incorrect. The correct answer is "+Ques_Ans[i][2]);






      System.out.print("\t===== DISPLAY RESULTS =====");
      System.out.println("\n Number of correct answers: "+ correct);
      System.out.println("\n Number of incorrect answers: "+ incorrect);
      System.out.print("\tEnd of Program");


    public static void main(String[] args){


Leave a Reply

Your email address will not be published. Required fields are marked *