Skip to content

Commit 717659f

Browse files
authored
Add files via upload
1 parent 3be89cc commit 717659f

15 files changed

+364
-0
lines changed

MCQ_Demo.iml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
11+
</component>
12+
</module>
1.27 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
3.11 KB
Binary file not shown.

out/production/MCQ_Demo/csv/HTML.csv

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Q1. HTML stands for -,A. HighText Machine Language,B. HyperText and links Markup Language,C. HyperText Markup Language,D. None of these,C
2+
Q2. The correct sequence of HTML tags for starting a webpage is -,A. Head/ Title/ HTML/ body,B. HTML/ Body/ Title/ Head,C. HTML/ Head/ Title/ Body,D. HTML/ Head/ Title/ Body,D
3+
Q3. Which of the following element is responsible for making the text bold in HTML?,A. <pre>,B. <a>,C. <b>,D.<br>,C
4+
Q4. Which of the following tag is used for inserting the largest heading in HTML?,A. <h3>,B. <h1>,C. <h5>,D. <h6>,B
5+
Q5. Which of the following tag is used to insert a line-break in HTML?,A. <br>,B. <a>,C. <pre>,D. <b>,A
6+
Q6. How to create an unordered list (a list with the list items in bullets) in HTML?,A. <ul>,B. <ol>,C. <li>,D. <l>,A
7+
Q7. Which character is used to represent the closing of a tag in HTML?,A. \,B. !,C. /,D. .,C
8+
Q8. How to create a hyperlink in HTML?,"A. <a href = ""www.javatpoint.com""> javaTpoint.com </a>","B. <a url = ""www.javatpoint.com"" javaTpoint.com /a>","C. <a link = ""www.javatpoint.com""> javaTpoint.com </a>",D. <a> www.javatpoint.com <javaTpoint.com /a>,A
9+
Q9. How to create an ordered list (a list with the list items in numbers) in HTML?,A. <ul>,B. <ol>,C. <li>,D. <l>,B
10+
Q10. Which of the following element is responsible for making the text italic in HTML?,A. <i>,B. <italic>,C. <it>,D. <pre>,A

out/production/MCQ_Demo/csv/Java.csv

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Q1. AWT is used for GUI programming in java?,A. True,B. False,C. Error,D. Close,A
2+
Q2. Which is a component in AWT that can contain another components like buttons/textfields/labels etc.?,A. Window,B. Container,C. Panel,D. Frame,B
3+
Q3. Which servlet does struts framework use?,A. EntryServlet,B. StrutsServlet,C. ActionServlet,D. BasicServlet,C
4+
Q4. The struts 2 framework is used to develop MVC- based web application,A. True,B. False,C. Error,D.Close,A
5+
Q5. In which the JDBC type represents a single precision floating point number that supports seven digits of mantissa?,A. REAL,B. DOUBLE,C. FLOAT,D. INTEGER,A
6+
Q6. In which model a Java applet or application talks directly to the data source?,A. Two-tier models,B. Three-tier models,C. Both A & B,D. None of the above,A
7+
Q7. A JDBC technology-based driver JDBC driver makes it possible to do,A. Establish a connection with a data source,B. Send queries and update statements to the data source,C. Process the results,D. All mentioned above,D
8+
Q8. Which of the following methods are members of the Vector class and allow you to input a new element?,A. addElement,B.insert,C. append,D. addItem,A
9+
Q9. What can cause a thread to stop executing?,A. The program exits via a call to System.exit(0);,B. Another thread is given a higher priority,C. A call to the thread's stop method,D. All of the above,D
10+
Q10. Which of the following statements are correct?,A. If multiple listeners are added to a component only events for the last listener added will be processed,B. If multiple listeners are added to a component the events will be processed for all but with no guarantee in the order,C. Adding multiple listeners to a comnponent will cause a compile time error,D. You can not remove or add listeners to a component.,B

out/production/MCQ_Demo/csv/PHP.csv

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Q1 Which of the following is not true? ,A.PHP can be used to develop web applications.,B.PHP makes a website dynamic,C.PHP applications can not be compile,D.PHP can not be embedded into html,D
2+
Q2 What is the name of function used to convert an array into a string?,A.explode(),B.glue(),C.implode(),D.None of the above,C
3+
Q3 list in PHP is ?,A.Language construct,B.Keyword,C.A & C Both,D.None of the above,A
4+
Q4 PHP stands for,A.Process Hypertext Preprocessor,B.Hypertext Preprocessor,C.Preprocessor Hypertext,D.None of the above,B
5+
Q5 PHP scripts are used in ,A. Server-side scripting,B.Command-line scripting,C. Client-side GUI applications,D.All of these above,D
6+
Q6 Select the incorrect statement about PHP programming language ,A. Variables are case-insensitive,B. Classes are case-insensitive,C. Functions rae case-insensitive,D. Constants are case-sensitive,A
7+
Q7 In PHP programming literal is a ,A. Class,B. Function,C. Data value,D. None of these above,C
8+
Q8 Class member variables are also called?,A.Properties,B.Fields,C.Attributes,D.All of the above,D
9+
Q9 Which of the following method sends input to a script via a URL? ,A.Get,B.Post,C.Both,D.None,A
10+
Q10 Which of the following variables is not a predefined variable? ,A.$get,B.$ask,C.$request,D.$post,B

src/MCQProject/Naming.java

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package MCQProject;
2+
3+
public class Naming {
4+
private String userName;
5+
private int choosing;
6+
7+
public void setChoice(int choice) {
8+
this.choosing = choice;
9+
}
10+
11+
public String getName() {
12+
return userName;
13+
}
14+
15+
public void setName(String name) {
16+
this.userName = name;
17+
}
18+
19+
public int getChoice() {
20+
return choosing;
21+
}
22+
23+
@Override
24+
public String toString() {
25+
return "Student{" +
26+
"name='" + userName + '\'' +
27+
", choice=" + choosing +
28+
'}';
29+
}
30+
31+
32+
}

src/MCQProject/QuestionAndAnswer.java

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
package MCQProject;
2+
import java.io.BufferedReader;
3+
import java.io.FileReader;
4+
import java.io.IOException;
5+
import java.util.Scanner;
6+
7+
public class QuestionAndAnswer {
8+
BufferedReader br = null;
9+
String line = "";
10+
String commaCsv = ",";
11+
public static double trueAns = 0.0;
12+
public static double falseAns = 0.0;
13+
Scanner sc = new Scanner(System.in);
14+
15+
public void MCQ(int choice) throws IOException {
16+
switch (choice) {
17+
//file location for MCQ sets
18+
case 1: {
19+
try {
20+
{
21+
String fileLocation = "C:\\\\Users\\\\Victor Swuan Yee Lin\\\\IdeaProjects\\\\MCQ_Demo\\\\src\\\\csv\\\\Java.csv";
22+
23+
br = new BufferedReader(new FileReader(fileLocation));
24+
//BufferedReader is reading csv file and save it into line String variable
25+
//This process is iterating end of csv files (MCQ Questions)
26+
while ((line = br.readLine()) != null) {
27+
//Reading csv file using BufferedReader
28+
29+
String[] QueAndAns = line.split(commaCsv);
30+
//Showing MCQ Question to the user in console screen
31+
32+
System.out.println("Please answer with Capital Letter !!! \n");
33+
System.out.println(QueAndAns[0] + "\n" + QueAndAns[1] + "\n" + QueAndAns[2] + "\n" + QueAndAns[3] + "\n" + QueAndAns[4]);
34+
System.out.print("Type your Answer Here: ");
35+
String Ans = sc.next(); //Requesting answer from the user
36+
if (QueAndAns[5].equals(Ans)) {//Testing user answer is correct or not
37+
System.out.println("Your answer is correct.");
38+
System.out.println("*******************************************************");
39+
trueAns++;
40+
} else {
41+
System.out.println("Your answer is Wrong !!!");
42+
System.out.println("*******************************************************");
43+
falseAns++;
44+
45+
}
46+
}
47+
}
48+
} catch (Exception e) {
49+
e.printStackTrace();
50+
} finally {
51+
br.close();
52+
}
53+
}
54+
break;
55+
case 2 : {
56+
try {
57+
{
58+
String fileLocation = "C:\\\\Users\\\\Victor Swuan Yee Lin\\\\IdeaProjects\\\\MCQ_Demo\\\\src\\\\csv\\\\HTML.csv";
59+
60+
br = new BufferedReader(new FileReader(fileLocation));
61+
//BufferedReader is reading csv file and save it into line String variable
62+
//This process is iterating end of csv files (MCQ Questions)
63+
while ((line = br.readLine()) != null) {
64+
//Reading csv file using BufferedReader
65+
66+
String[] QueAndAns = line.split(commaCsv);
67+
//Showing MCQ Question to the user in console screen
68+
69+
System.out.println("Please answer with Capital Letter !!! \n");
70+
System.out.println(QueAndAns[0] + "\n" + QueAndAns[1] + "\n" + QueAndAns[2] + "\n" + QueAndAns[3] + "\n" + QueAndAns[4]);
71+
System.out.print("Type your Answer Here: ");
72+
String Ans = sc.next(); //Requesting answer from the user
73+
if (QueAndAns[5].equals(Ans)) {//Testing user answer is correct or not
74+
System.out.println("Your answer is correct.");
75+
System.out.println("*******************************************************");
76+
trueAns++;
77+
} else {
78+
System.out.println("Your answer is Wrong !!!");
79+
System.out.println("*******************************************************");
80+
falseAns++;
81+
82+
}
83+
}
84+
}
85+
} catch (Exception e) {
86+
e.printStackTrace();
87+
} finally {
88+
br.close();
89+
}
90+
}
91+
break;
92+
case 3 : {
93+
try {
94+
{
95+
String fileLocation = "C:\\\\Users\\\\Victor Swuan Yee Lin\\\\IdeaProjects\\\\MCQ_Demo\\\\src\\\\csv\\\\PHP.csv";
96+
97+
br = new BufferedReader(new FileReader(fileLocation));
98+
//BufferedReader is reading csv file and save it into line String variable
99+
//This process is iterating end of csv files (MCQ Questions)
100+
while ((line = br.readLine()) != null) {
101+
//Reading csv file using BufferedReader
102+
103+
String[] QueAndAns = line.split(commaCsv);
104+
//Showing MCQ Question to the user in console screen
105+
106+
System.out.println("Please answer with Capital Letter !!! \n");
107+
System.out.println(QueAndAns[0] + "\n" + QueAndAns[1] + "\n" + QueAndAns[2] + "\n" + QueAndAns[3] + "\n" + QueAndAns[4]);
108+
System.out.print("Type your Answer Here: ");
109+
String Ans = sc.next(); //Requesting answer from the user
110+
if (QueAndAns[5].equals(Ans)) {//Testing user answer is correct or not
111+
System.out.println("Your answer is correct.");
112+
System.out.println("*******************************************************");
113+
trueAns++;
114+
} else {
115+
System.out.println("Your answer is Wrong !!!");
116+
System.out.println("*******************************************************");
117+
falseAns++;
118+
119+
}
120+
}
121+
}
122+
} catch (Exception e) {
123+
e.printStackTrace();
124+
} finally {
125+
br.close();
126+
}
127+
}
128+
129+
}
130+
}
131+
//restart the user score when the user re-answer the MCQ questions
132+
public void reset(){
133+
trueAns = 0.0;
134+
falseAns = 0.0;
135+
}
136+
}

src/MCQProject/ResultPercentage.java

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package MCQProject;
2+
3+
public class ResultPercentage extends QuestionAndAnswer {
4+
double percentage;
5+
6+
//output of user score end of the MCQ
7+
public void outputResult(){
8+
percentage = (trueAns /10)*100;
9+
System.out.println("You answered "+ trueAns + " Questions Right, " + falseAns + " Questions are Wrong for Total of 10 Questions.");
10+
System.out.println("Congratulations!!! Your Score is "+ percentage +"%");
11+
}
12+
13+
}
14+

src/MCQProject/SylMain.java

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
package MCQProject;
2+
3+
import java.io.IOException;
4+
import java.util.Scanner;
5+
6+
public class SylMain {
7+
public static void main(String[] args) throws IOException {
8+
9+
greeting();//Calling to welcome method
10+
11+
//calling userInput name method
12+
Naming s = new Naming();
13+
s.setName(userInput());
14+
15+
16+
do {
17+
MCQType();
18+
s.setChoice(choiceMCQType());//calling choiceMCQType methods
19+
QuestionAndAnswer mc = new QuestionAndAnswer();//calling QuestionAndAnswer
20+
mc.reset();// to restart the scoring program
21+
mc.MCQ(s.getChoice());
22+
23+
System.out.println("Learner name: " + s.getName());
24+
25+
ResultPercentage usc = new ResultPercentage();
26+
usc.outputResult();
27+
28+
reUse();
29+
s.setChoice(exitToChoose());
30+
if (s.getChoice()==2){
31+
Exit();
32+
break;
33+
}
34+
} while (s.getChoice() == 1) ;
35+
36+
37+
}
38+
//choosing answer again or exit when the user end to answer the MCQ questions
39+
public static void reUse(){
40+
System.out.println(" ");
41+
System.out.println("Do you want to try another question?");
42+
System.out.println("1. Answer Again.");
43+
System.out.println("2. Exit.");
44+
}
45+
//thank you message
46+
public static void Exit(){
47+
System.out.println("*******************************************************");
48+
System.out.println(" ");
49+
System.out.println("Thank you for your answering our MCQ Questions.");
50+
System.out.println(" ");
51+
System.out.println("*******************************************************");
52+
53+
}
54+
55+
//welcome message at the start of the program
56+
public static void greeting(){
57+
System.out.println(" ");
58+
System.out.println("Welcome to our 'ABC Learning Center' ");
59+
System.out.println("*******************************************************");
60+
System.out.print("Please enter your name: ");
61+
}
62+
63+
//Scanner for user name input
64+
public static String userInput() {
65+
Scanner sc = new Scanner(System.in);
66+
String Name = sc.nextLine();
67+
return Name;
68+
}
69+
//show the questions set name
70+
public static void MCQType() {
71+
System.out.println("Please kindly choose MCQ Question Set.");
72+
System.out.println("\nChoose your Multiple Choice Question Set. The Options are:");
73+
System.out.println("1. Java");
74+
System.out.println("2. HTML");
75+
System.out.println("3. PHP");
76+
}
77+
78+
//user can choose MCQ type here like 1 or 2 or 3 (user can only type number 1 or 2 or 3)
79+
public static int choiceMCQType(){
80+
System.out.print("Enter MCQ Question Set: ");
81+
Scanner sc= new Scanner(System.in);
82+
int choice = sc.nextInt();
83+
System.out.println("*******************************************************");
84+
return choice;
85+
86+
87+
}
88+
/*//Divide and Conquer
89+
public static void thirdQ(){
90+
System.out.println();
91+
System.out.println("This is the third question");
92+
System.out.println();
93+
System.out.println();
94+
95+
System.out.println("Which of the following for loop declaration is not valid?");
96+
System.out.println("1. for ( int i = 99; i >= 0; i / 9 )");
97+
System.out.println("2. for ( int i = 7; i <= 77; i += 7 )");
98+
System.out.println("3. for ( int i = 20; i >= 2; - -i )");
99+
System.out.println("4. for ( int i = 2; i <= 20; i = 2* i )");
100+
}*/
101+
102+
//scanner for choose exit or answer again at end of the program
103+
public static int exitToChoose() {
104+
System.out.print("Choose One: ");
105+
Scanner sc=new Scanner(System.in);
106+
int choose=sc.nextInt();
107+
return choose;
108+
}
109+
110+
}

src/csv/HTML.csv

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Q1. HTML stands for -,A. HighText Machine Language,B. HyperText and links Markup Language,C. HyperText Markup Language,D. None of these,C
2+
Q2. The correct sequence of HTML tags for starting a webpage is -,A. Head/ Title/ HTML/ body,B. HTML/ Body/ Title/ Head,C. HTML/ Head/ Title/ Body,D. HTML/ Head/ Title/ Body,D
3+
Q3. Which of the following element is responsible for making the text bold in HTML?,A. <pre>,B. <a>,C. <b>,D.<br>,C
4+
Q4. Which of the following tag is used for inserting the largest heading in HTML?,A. <h3>,B. <h1>,C. <h5>,D. <h6>,B
5+
Q5. Which of the following tag is used to insert a line-break in HTML?,A. <br>,B. <a>,C. <pre>,D. <b>,A
6+
Q6. How to create an unordered list (a list with the list items in bullets) in HTML?,A. <ul>,B. <ol>,C. <li>,D. <l>,A
7+
Q7. Which character is used to represent the closing of a tag in HTML?,A. \,B. !,C. /,D. .,C
8+
Q8. How to create a hyperlink in HTML?,"A. <a href = ""www.javatpoint.com""> javaTpoint.com </a>","B. <a url = ""www.javatpoint.com"" javaTpoint.com /a>","C. <a link = ""www.javatpoint.com""> javaTpoint.com </a>",D. <a> www.javatpoint.com <javaTpoint.com /a>,A
9+
Q9. How to create an ordered list (a list with the list items in numbers) in HTML?,A. <ul>,B. <ol>,C. <li>,D. <l>,B
10+
Q10. Which of the following element is responsible for making the text italic in HTML?,A. <i>,B. <italic>,C. <it>,D. <pre>,A

src/csv/Java.csv

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Q1. AWT is used for GUI programming in java?,A. True,B. False,C. Error,D. Close,A
2+
Q2. Which is a component in AWT that can contain another components like buttons/textfields/labels etc.?,A. Window,B. Container,C. Panel,D. Frame,B
3+
Q3. Which servlet does struts framework use?,A. EntryServlet,B. StrutsServlet,C. ActionServlet,D. BasicServlet,C
4+
Q4. The struts 2 framework is used to develop MVC- based web application,A. True,B. False,C. Error,D.Close,A
5+
Q5. In which the JDBC type represents a single precision floating point number that supports seven digits of mantissa?,A. REAL,B. DOUBLE,C. FLOAT,D. INTEGER,A
6+
Q6. In which model a Java applet or application talks directly to the data source?,A. Two-tier models,B. Three-tier models,C. Both A & B,D. None of the above,A
7+
Q7. A JDBC technology-based driver JDBC driver makes it possible to do,A. Establish a connection with a data source,B. Send queries and update statements to the data source,C. Process the results,D. All mentioned above,D
8+
Q8. Which of the following methods are members of the Vector class and allow you to input a new element?,A. addElement,B.insert,C. append,D. addItem,A
9+
Q9. What can cause a thread to stop executing?,A. The program exits via a call to System.exit(0);,B. Another thread is given a higher priority,C. A call to the thread's stop method,D. All of the above,D
10+
Q10. Which of the following statements are correct?,A. If multiple listeners are added to a component only events for the last listener added will be processed,B. If multiple listeners are added to a component the events will be processed for all but with no guarantee in the order,C. Adding multiple listeners to a comnponent will cause a compile time error,D. You can not remove or add listeners to a component.,B

0 commit comments

Comments
 (0)