-
Notifications
You must be signed in to change notification settings - Fork 0
/
JAVAExer.html
247 lines (239 loc) · 12.6 KB
/
JAVAExer.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<!DOCTYPE html>
<html lang="en">
<head>
<!-- ad sense tag-->
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1733919132650092"
crossorigin="anonymous"></script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FBJL1SB5QM"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-FBJL1SB5QM');
</script>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description"
content="CodingNation provides exercises to pratice and learn coding. Coding Nation Execise are used to enhance your coding skills">
<meta name="keywords"
content="coding, programming, tutorial, learn, HTML, CSS, JavaScript, Python, resources, free, code tutorial, coding exercises, coding challenges, learn to code, coding skills">
<meta name="author" content="coding-nation">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="index, follow">
<link rel="icon" type="image/png" sizes="32x32" href="../images/favicon.png">
<title>JAVA Exercise</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous" />
<link rel="stylesheet" href="../Styles/Exercise.css">
</head>
<body>
<!--navigation bar-->
<header class="fixed-navbar">
<!--navigation bar-->
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<div class="container-fluid">
<a class="navbar-brand" href="../index.html">CodingNation</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto" id="navbarNavLinks">
<li class="nav-item">
<a class="nav-link" href="../index.html">Home</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-controls="navbarNav" aria-expanded="false"
aria-label="Toggle navigation">Courses</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="../Python.html">Python</a>
</li>
<li>
<a class="dropdown-item" href="../React.html">React JS</a>
</li>
<li>
<a class="dropdown-item" href="../html.html">HTML</a>
</li>
<li><a class="dropdown-item" href="../css.html">CSS</a></li>
<li>
<a class="dropdown-item" href="../jascri.html">JavaScript</a>
</li>
<li><a class="dropdown-item" href="../cpro.html">C</a></li>
<li>
<a class="dropdown-item" href="../java.html">Java</a>
</li>
<li><a class="dropdown-item" href="../php.html">PHP</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button"
data-bs-toggle="dropdown">Practice</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="../HTMLQuiz.html" target="_blank">HTML Quiz</a>
</li>
<li>
<a class="dropdown-item" href="../CSSQuiz.html" target="_blank">CSS Quiz</a>
</li>
<li>
<a class="dropdown-item" href="../JSQuiz.html" target="_blank">JavaScript Quiz</a>
</li>
<li>
<a class="dropdown-item" href="../CQuiz.html" target="_blank">C Quiz</a>
</li>
<li>
<a class="dropdown-item" href="../JAVAQuiz.html" target="_blank">Java Quiz</a>
</li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button"
data-bs-toggle="dropdown">Exercises</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="../HTMLExer.html" target="_blank">HTML Exercise</a>
</li>
<li>
<a class="dropdown-item" href="../CSSExer.html" target="_blank">CSS Exercise</a>
</li>
<li>
<a class="dropdown-item" href="../JsExer.html" target="_blank">JavaScript
Exercise</a>
</li>
<li>
<a class="dropdown-item" href="../CExer.html" target="_blank">C Exercise</a>
</li>
<li>
<a class="dropdown-item" href="../JAVAExer.html" target="_blank">Java Exercise</a>
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="../codebot.html" target="_blank">CodeBot</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../Editor.html" target="_blank">Editor</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../About.html">About</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<h1 class="float-start">Exercise</h1>
<p id="title"></p>
<div class="questions" id="questions"></div>
<div class="bt">
<button type="submit" id="submit">Submit</button>
<button id="next">Next</button>
<button id="wrong">Try Again</button>
<button id="showAnswer">Show Answer</button>
</div>
</div>
<!-- Footer Section -->
<footer class="container-fluid text-center">
<hr />
<span class="bi bi-caret-up" onclick="topFunction()"></span>
<p>Copyright © 2023 CodingNation. All rights reserved. <br /></p>
<p>
Trademark ™ CodingNation
<a href="https://www.coding-nation.com/">www.coding-nation.com</a>
</p>
</footer>
<script>
const submit = document.getElementById("submit");
const next = document.getElementById("next");
const wrong = document.getElementById("wrong");
const questions = document.getElementById("questions");
const head = document.getElementById("title");
const showAnswer = document.getElementById("showAnswer");
const quiz = [
{
title:
"Insert the missing part of the code below to output \"Hello World\".",
question: `<p>public class MyClass { <br>
public static void main(String[] args) { <br><input style="width:260px;" type="text" maxlength="42">
("Hello World"); <br>}<br>}</p>`,
answer: "System.out.println",
},
{
title:
"Add the correct data type for the following variables:",
question: `<p><input type="text" maxlength="42"> myText = "Hello World";</p>`,
answer: "String",
},
{
title:
"Add the correct data type for the following variables:",
question: `<p><input type="text" maxlength="42"> myBool = false;</p>`,
answer: "Boolean",
},
{
title:
"byte, short, int, long, float, double, boolean and char are called:",
question: `<p><input type="text" maxlength="42"> Data Types</p>`,
answer: "Primitive",
},
{
title:
"Fill in the blanks to Divide the following numbers, and print the result.",
question: `<p> int x = 10;<br>int y = 5;<br>System.out.println( x<input type="text" maxlength="4"> y);</p>`,
answer: "/",
},
{
title:
"Fill in the blanks to Multiply the following numbers, and print the result.",
question: `<p> int x = 10;<br>int y = 5;<br>System.out.println( x<input type="text" maxlength="4"> y);</p>`,
answer: "*",
},
{
title:
"Fill in the blanks to Add the following numbers, and print the result.",
question: `<p> int x = 10;<br>int y = 5;<br>System.out.println( x<input type="text" maxlength="4"> y);</p>`,
answer: "+",
},
{
title:
"Fill in the blanks to Subtract the following numbers, and print the result.",
question: `<p> int x = 10;<br>int y = 5;<br>System.out.println( x<input type="text" maxlength="4"> y);</p>`,
answer: "-",
},
{
title:
"Use the correct method to print the length of the txt string.",
question: `<p> String txt = "Hello";<br>System.out.println( <input style="width:150;" type="text" maxlength="4">) ;</p>`,
answer: "txt.length()",
},
{
title:
"Use the correct method to convert the string into LowerCase.",
question: `<p> String txt = "Hello";<br>System.out.println( <input style="width:150;" type="text" maxlength="4">) ;</p>`,
answer: "txt.toLowercase()",
},
{
title:
"Use the correct method to convert the string into UpperCase.",
question: `<p> String txt = "Hello";<br>System.out.println( <input style="width:150;" type="text" maxlength="4">) ;</p>`,
answer: "txt.toUppercase()",
},
{
title:
"Use the correct operator to concatenate two strings:",
question: `<p> String firstName = "John "; <br>String lastName = "Doe";<br>System.out.println( firstName<input type="text" maxlength="4">lastname) ;</p>`,
answer: "+",
},
];
</script>
<script src="../Scripts&xml/Exercise.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe"
crossorigin="anonymous"></script>
</body>
</html>