0% found this document useful (0 votes)
2 views

CSC 417 PROGRAMMING WITH JAVA AND UML solve

The document contains a series of multiple-choice questions related to programming with Java and UML, covering topics such as control structures, arrays, object-oriented programming, and Java syntax. It includes questions about legal class names, print statements, memory usage, and loops. The questions are designed to assess understanding of fundamental programming concepts and Java language specifics.

Uploaded by

Edmund Kpebah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

CSC 417 PROGRAMMING WITH JAVA AND UML solve

The document contains a series of multiple-choice questions related to programming with Java and UML, covering topics such as control structures, arrays, object-oriented programming, and Java syntax. It includes questions about legal class names, print statements, memory usage, and loops. The questions are designed to assess understanding of fundamental programming concepts and Java language specifics.

Uploaded by

Edmund Kpebah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

CSC 417 PROGRAMMING WITH JAVA

AND UML
[email protected] Switch account

* Indicates required question

Section A

Which of the following control structures is most ideal for writing code to display *
the grades of students according to their corresponding marks

Switch case

One-way if statements

Two-way if statement

if-else ladder

Which of the following is true about arrays *

the size of an array cannot be specified at instantiation of the array

Instantiating as array means assigning values to the array

the statement; int age[ ] = new int[21] means that we are assigning the value 21 to
the array age.

you don't need to specify the size of an array that is initialized


The process of writing Java codes for the computer to perform specific task is *
called

Java multitasking

Java tasking

Java process writing

Computer programming

Java Code writing

The following can be referred to as... (Select the best answer) *

a source code

a computer program

a Java program

a Java source code

All the above

non of the above


Which of the following is an illegal class name (select the best answer) *

a. MYCLASS

b. main

c. my_Class

d. MyClass

e. main_Class

f. a, b & e only

g. b, c, & e only

h. a, c, d , & e only

i. none of the above

j. all of the above

Rewrite the following two statements using one print method (note that the *
statements are separated by the symbol |• ) System.out.println(“Hi my age
is”); |• System.out.println(4);

System.out.println(“Hi my age is” 4);

System.out,println("Hi my age is" + 4);

System.out.println("Hi my age is' + 4);

System.out.println("Hi my age is" + 4)

System.Out.println("Hi my age is" + 4);

System.out.println('Hi my age is' + 4);

system.out.println("Hi my age is" + 4);

System.out.print("Hi my age is" + 4);


What value will be stored after executing the following statement: *
System.out.println(2 + 4 >3);

error

true

false

6>3

2+4>3

2+4

Which of the following Java statement is legal *

a. char aValue = ‘9’;

b. int aValue = 9;

c. all of the above

d. non of the above


Which of the following is true

a. An OOP can have attributes but not behaviour

b. functions and methods in OOP is the same as behviour

c. a computer mouse can have click, drag, and scroll as its OOP attributes

d. Account holder's phone number is more of an OOP behaviour than attribute

b and c only

b, c and d only

a, b, c only

all of the above

non of the above

Which of the OOP features can be found in the following code *

Object

Encapsulation

instance

Polymorphism

Constructor
Which of the following is true about the following code (Select the best answer) *

i. Polymorphism

ii. Encapsulation

iii. Initialization by constructor

iv. Data hiding

v. object oriented

vi. initialization by reference

a. i, iii, iv only

b. i, iii, vi only

c. i, iii, v only

d. i, ii, iii, vi only

e. i, ii, iii, v, vii only

A Java program can use a humidity senor resource through *

an object

a constructor

a System class with defined methods for the sensor

a main method
How much memory in bytes can a Boolean value occupy. *

True

1 bit

False

True or False

1 byte

True and False

0.125 bytes

Which of the following is true from the code (Select the best answer) *

I. h is not a local variable to mult( )

II. m is an instance of exam

III. the output of m.mult( ) is the results of n/b

IV. the value of h is displayed by the execution of -- m.mult()

A. I,II,IV

B. I,II

C. II,III,IV

D. II, IV

M. NON OF THE ABOVE


which of the following loops is true for the following statement; "Keep adding *
students to class (cls) until class size is 300".

int cls; for(cls=0; cls<=300; cls ++) {System.out.printl(cls);}

int cls; while(cls<=300){System.out.println(cls); cls ++;}

int cls do{System.out.println(cls); cls ++;} while(cls<=300);

all the above

non of the above

Consider the following code and answer the following questions

What is the return type for the main method? *

static

public

String[ ] args

all the above

none of the above


Which of the following is true about the source code? *

the variables in the method add( ) are not accessible by any other method

assigning y.add( ) in line 13 to a variable will generate an error

j is an instance of Java_basics

none of the above

which line of code creates an object *

13

12

Identify the instance variables in the source code *

a and b

y and j

Back Submit Page 2 of 2 Clear form

Never submit passwords through Google Forms.

This content is neither created nor endorsed by Google. - Terms of Service - Privacy Policy

Does this form look suspicious? Report

Forms

You might also like