CSC202: PROGRAMMING II-2ND SEMESTER-2019 SESSION-EXAM PAST QUESTION POST

 

CSC202: PROGRAMMING II

(FUO, 2018/2019 SESSION, 2ND SEMESTER)

INSTRUCTION: ANSWER 4 QUESTION ONLY: 2 FROM EACH SECTION

 

SECTION A

1.      QUESTION ONE

a.      Give reasons for the answer you provide for the following questions

                                                              i.      Which of the following classes will have more memory allocated?

Ø  Class A: Three methods, four variables, no object

Ø  Class B: Five methods, three variables, no object

                                                            ii.      What are the two environment variables that must be set in order to run any Java program?

                                                          iii.      Is JDK required on each machine to run a Java program?

                                                           iv.      Can we have two methods in a class with the same name?

                                                             v.      Can JVM run programs which are written in other languages?

                                                           vi.      Are Java’s mishandled runtime errors unresolved?

b.      Illustrate how an object is created In Java? State 3 function of an object.

2.      QUESTION TWO

a.      The Dilution Rate for Maximum Productivity in a continuous Stirred-Tank Reactor (CSTR) is given as:                      DMAX = µmax [1-√ ks/(ks + csin)]                 

µmax = Maximum specific growth reaction rate, Csin = Substrate concentration entering the reactor, DMAX  = Dilution rate for maximum productivity, Ks = Monod constant = 0.5.                                                          

Evolve Java codes to compute five different values of the dilution rate for maximum productivity, DMAX for different values of the other independent variables.

SECTION B

3.      QUESTION THREE

a.      Q3

                                                              i.      What happens if an exception is not handled in a program?

                                                            ii.      What’s the significance of packages? Does importing a package imports its sub-packages as well, in Java?

b.      Write a program that accepts a series of numbers, ignores the negative ones and terminates when the sum is greater than 1000.

4.      QUESTION FOUR

a.      At what point are classes useful? Demonstrate polymorphism using simple Java programs

b.      Write a small Java program that adds all the columns of a 3 x 4 matrix

5.      QUESTION FIVE

a.      The sum of the first nth terms of an arithmetic sequence is given by:        

       Sn =  (2a + (n-1)d). Write a program that computes Sn.

b.      Can we declare the main method of our class as private? Give reasons. What is the difference between main() function in C++ and main() function in Java?

Comments

Popular posts from this blog

FEN 202: ENGINEERING MATHEMATICS III TEST (CARRY-OVER) 2021