Skip to content

Commit eb58e83

Browse files
authored
Merge pull request #60 from udohjeremiah/dev
Add 2 new past questions.
2 parents d9a0bfe + cd9db56 commit eb58e83

File tree

3 files changed

+553
-183
lines changed

3 files changed

+553
-183
lines changed
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
import Questions from "@/components/Questions";
2+
import Answers from "@/components/Answers";
3+
4+
export default function CSC201() {
5+
return (
6+
<Questions
7+
school="western delta university"
8+
college="computing"
9+
department="computer science"
10+
session="2023/2024"
11+
semester="first semester"
12+
courseCode="CSC201"
13+
courseTitle="computer programming I (Java)"
14+
allowedTime="2hrs: 30mins"
15+
instruction="answer question 1 and any other three (3) questions"
16+
>
17+
<li>
18+
<h4 className="mb-2 font-bold">Question 1 (Compulsory)</h4>
19+
<ol className="flex list-[lower-alpha] flex-col gap-2">
20+
<li>
21+
State two reasons why we learn both structured programming and
22+
object-oriented programming.{" "}
23+
<strong className="whitespace-nowrap">(4 marks)</strong>
24+
<Answers questionNumber="1a" />
25+
</li>
26+
<li>
27+
State two major application areas of Java programming language.{" "}
28+
<strong className="whitespace-nowrap">(2 marks)</strong>
29+
<Answers questionNumber="1b" />
30+
</li>
31+
<li>
32+
State two major features of Unified Modeling Language (UML).{" "}
33+
<strong className="whitespace-nowrap">(4 marks)</strong>
34+
<Answers questionNumber="1c" />
35+
</li>
36+
<li>
37+
The entity television can be regarded as a class with attributes and
38+
behaviours. Derive the attributes and behaviour of the class
39+
television using UML class diagram.{" "}
40+
<strong className="whitespace-nowrap">(5 marks)</strong>
41+
<Answers questionNumber="1d" />
42+
</li>
43+
<li>
44+
Highlight the four vital components of a for loop.{" "}
45+
<strong className="whitespace-nowrap">(4 marks)</strong>
46+
<Answers questionNumber="1e" />
47+
</li>
48+
<li>
49+
A person invests a certain of money in a savings account at a given
50+
interest. Assuming that all the interest is left on deposit,
51+
calculate and display the amount of money in the account at the end
52+
of each year for n years. Write a Java application to determine the
53+
amounts using the formula:
54+
<br />
55+
<strong>
56+
A = P(1+R)<sup>n</sup>
57+
</strong>
58+
<br />
59+
where
60+
<br />
61+
P is the original amount invested (i.e., the principal)
62+
<br />
63+
R is the annual interest rate
64+
<br />
65+
n is the number of years
66+
<br />A is the amount on deposit at the end of the nth year.{" "}
67+
<strong className="whitespace-nowrap">(6 marks)</strong>
68+
<Answers questionNumber="1f" />
69+
</li>
70+
</ol>
71+
</li>
72+
73+
<li>
74+
<h4 className="mb-2 font-bold">Question 2</h4>
75+
<ol className="flex list-[lower-alpha] flex-col gap-2">
76+
<li>
77+
Define the following terms as used in Java development environment.
78+
<ol className="mx-4 list-[lower-roman]">
79+
<li>Javac.exe</li>
80+
<li>Java.exe</li>
81+
</ol>
82+
<strong className="whitespace-nowrap">(4 marks)</strong>
83+
<Answers questionNumber="2a" />
84+
</li>
85+
<li>
86+
Why is the Java programming language platform independent?
87+
Illustrate with a diagram.{" "}
88+
<strong className="whitespace-nowrap">(4 marks)</strong>
89+
<Answers questionNumber="2b" />
90+
</li>
91+
<li>
92+
What is a loop?{" "}
93+
<strong className="whitespace-nowrap">(2 marks)</strong>
94+
<Answers questionNumber="2c" />
95+
</li>
96+
<li>
97+
Write a Java application that computes the sum of square of even
98+
numbers between 2 and 50.{" "}
99+
<strong className="whitespace-nowrap">(5 marks)</strong>
100+
<Answers questionNumber="2d" />
101+
</li>
102+
</ol>
103+
</li>
104+
105+
<li>
106+
<h4 className="mb-2 font-bold">Question 3</h4>
107+
<ol className="flex list-[lower-alpha] flex-col gap-2">
108+
<li className="list-[lower-alpha]">
109+
Define the following:
110+
<ol className="mx-4 list-[lower-roman]">
111+
<li>Local variable</li>
112+
<li>Instance variable.</li>
113+
</ol>
114+
<strong className="whitespace-nowrap">(4 marks)</strong>
115+
<Answers questionNumber="3a" />
116+
</li>
117+
<li>
118+
What is a static method? Illustrate with one example.{" "}
119+
<strong className="whitespace-nowrap">(4 marks)</strong>
120+
<Answers questionNumber="3b" />
121+
</li>
122+
<li>
123+
Write a method that converts a Fahrenheit temperature to Celsius
124+
temperature using the expression:{" "}
125+
<code>Celsius = (Fahrenheit - 32) * 0.55</code>{" "}
126+
<strong className="whitespace-nowrap">(4 marks)</strong>
127+
<Answers questionNumber="3c" />
128+
</li>
129+
<li>
130+
Give the syntax of the <code>while</code> loop.{" "}
131+
<strong className="whitespace-nowrap">(3 marks)</strong>
132+
<Answers questionNumber="3d" />
133+
</li>
134+
</ol>
135+
</li>
136+
137+
<li>
138+
<h4 className="mb-2 font-bold">Question 4</h4>
139+
<ol className="flex list-[lower-alpha] flex-col gap-2">
140+
<li>
141+
Define enhanced for loop.{" "}
142+
<strong className="whitespace-nowrap">(2 marks)</strong>
143+
<Answers questionNumber="4a" />
144+
</li>
145+
<li>
146+
State one situation in which the use of the enhanced is valuable.
147+
<strong className="whitespace-nowrap">(2 marks)</strong>
148+
<Answers questionNumber="4b" />
149+
</li>
150+
<li>
151+
Highlight three methods available in the predefined class called
152+
Arrays. <strong className="whitespace-nowrap">(3 marks)</strong>
153+
<Answers questionNumber="4c" />
154+
</li>
155+
<li>
156+
Write a java program segment to illustrate each of the methods
157+
stated in (4c){" "}
158+
<strong className="whitespace-nowrap">(6 marks)</strong>
159+
<Answers questionNumber="4d" />
160+
</li>
161+
</ol>
162+
</li>
163+
164+
<li>
165+
<h4 className="mb-2 font-bold">Question 5</h4>
166+
<ol className="flex list-[lower-alpha] flex-col gap-2">
167+
<li>
168+
Define the following as used in Java file processing:
169+
<ol className="mx-4 list-[lower-roman]">
170+
<li>Stream</li>
171+
<li>Text file</li>
172+
<li>Sequential file.</li>
173+
</ol>
174+
<strong className="whitespace-nowrap">(6 marks)</strong>
175+
<Answers questionNumber="5a" />
176+
</li>
177+
<li>
178+
Write a Java program that requests from the user matriculation
179+
number, total points earned, total units registered and compute the
180+
GPA using the expression:{" "}
181+
<code>GPA = Total Points Earned / Total Units Registered</code>.
182+
Write your output consisting of Matriculation No., Total Units,
183+
Total Points, and GPA to a file named honour.txt.{" "}
184+
<strong className="whitespace-nowrap">(7 marks)</strong>
185+
<Answers questionNumber="5b" />
186+
</li>
187+
<li>
188+
Highlight two differences between a primitive variable and
189+
non-primitive variable.{" "}
190+
<strong className="whitespace-nowrap">(2 marks)</strong>
191+
<Answers questionNumber="5c" />
192+
</li>
193+
</ol>
194+
</li>
195+
196+
<li>
197+
<h4 className="mb-2 font-bold">Question 6</h4>
198+
<ol className="flex list-[lower-alpha] flex-col gap-2">
199+
<li>
200+
Define an ArrayList. llustrate with an example.{" "}
201+
<strong className="whitespace-nowrap">(4 marks)</strong>
202+
<Answers questionNumber="6a" />
203+
</li>
204+
<li>
205+
Define a static method. Illustrate with one example.{" "}
206+
<strong className="whitespace-nowrap">(4 marks)</strong>
207+
<Answers questionNumber="6b" />
208+
</li>
209+
<li>
210+
The scores of ten students in a given examination are represented in
211+
a one-dimensional array as follows: 57 40 34 61 66 56 48 56 52 51.
212+
Write methods to accomplish the following:
213+
<ol className="mx-4 list-[lower-roman]">
214+
<li>
215+
Compute the largest score{" "}
216+
<strong className="whitespace-nowrap">(3.5 marks)</strong>
217+
<Answers questionNumber="6c" />
218+
</li>
219+
<li>
220+
Compute the smallest score{" "}
221+
<strong className="whitespace-nowrap">(3.5 marks)</strong>
222+
<Answers questionNumber="6c" />
223+
</li>
224+
</ol>
225+
</li>
226+
</ol>
227+
</li>
228+
</Questions>
229+
);
230+
}

0 commit comments

Comments
 (0)