// Initialize a Scanner for user input Scanner scanner = new Scanner(System.in);
// Define the quiz questions and correct answers
String[] questions = { "What is Uopeople university Located?", "Who is the instructor for programming 1102?", "How many units are there in CS-1102 course?", "Who is supposed to make sure assignments are updated?", };
char[] correctAnswers = {'C', 'B', 'A', 'D'};
// Initialize variables to track user score
int totalQuestions = questions.length; int correctResponses = 0;
// Display the quiz questions and get user input
for (int i = 0; i < totalQuestions; i++) { System.out.println("Question " + (i + 1) + ":\n " + questions[i]); System.out.println("\nA) Nine units"); System.out.println("B) Dr. Ursa Sayeed"); System.out.println("C) Pasadena , California"); System.out.println("D) The Student \n"); System.out.print("Your answer (A, B, C, or D): ");