0% found this document useful (0 votes)
40 views6 pages

INFORMATICS 1A newPR

This document contains instructions for a 3-hour supplementary examination for a Bachelor of Commerce in Information and Technology Management program. It consists of 5 questions testing knowledge of programming concepts like data types, variables, control structures, methods and errors. Students are provided with an answer book to write their responses. The exam is closed book and they may not communicate with others during it.

Uploaded by

Tracy-lee Jacobs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views6 pages

INFORMATICS 1A newPR

This document contains instructions for a 3-hour supplementary examination for a Bachelor of Commerce in Information and Technology Management program. It consists of 5 questions testing knowledge of programming concepts like data types, variables, control structures, methods and errors. Students are provided with an answer book to write their responses. The exam is closed book and they may not communicate with others during it.

Uploaded by

Tracy-lee Jacobs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

SUPPLEMENTARY EXAMINATION

PROGRAMME Bachelor of Commerce in Information and Technology Management

MODULE Informatics 1A

YEAR One (1)

INTAKE January 2018

DATE 25 July 2018

TIME 09h00 – 12h00

DURATION 3 hours

TOTAL MARKS 100

INSTRUCTIONS TO THE CANDIDATE

1. Questions must be attempted in the answer book provided.


2. All queries should be directed to the invigilator; do not communicate or attempt to communicate with any
other candidate.
3. You have THREE HOURS to complete this paper. You are not allowed to leave the examination room within
the first hour and in the last 15 minutes of this examination.
4. This is a CLOSED BOOK examination.
5. Read ALL instructions carefully.

RJ
Answer ALL questions.

QUESTION 1 (20 Marks)

Multiple Choice
Write down the question number and the correct answer next to it, e.g. 1.21 B

1.1 Binary machine code is made up of:

A) 2’s and 3’s


B) 0’s and 1’s
C) 1’s and 2’s
D) 4’s and 5’s

1.2 When saving a Java file, the file name should always be the same as the:

A) Class name
B) Variable name
C) Object name
D) Method name

1.3 Consider the following code snippet and state the resulting value of num2:
int num1 = 30;
int num2 = 20;
num1 = num2 + 10;
A) 10
B) 50
C) Null
D) 20

1.4 An Integrated Development Environment (IDE) is a program that is designed to help programmers and
developers build:

A) Compilers
B) Software
C) Code
D) Instructions

1.5 Sub-programs within a program are called:

A) Classes
B) Objects
C) Methods
D) Code blocks

1
RJ
1.6 Expression a = = b is called a:

A) Comparison statement
B) Assignment statement
C) Logical operator
D) Boolean expression

1.7 Decisions are implemented in Java using the:

A) While structure
B) Do….while structure
C) For loop structure
D) If….else structure

1.8 What does the following code snippet do?

if (x > y)
Max = x;
else
Max = y;
A) Adds x and y
B) Compares x and y
C) Divides x by y
D) Compares x to y and returns the maximum value

1.9 Loops not bound by any number are called:

A) Repetition loops
B) Nested if….else
C) Sentinel loops
D) While loops

1.10 Consider the variables listed below. Which one of the following is an invalid variable name?

A) surname
B) _abc_
C) $total
D) 1surname

1.11 The double ampersand (&&) performs the AND function and is known as a:

A) Logical connective
B) Boolean connective
C) Decision connective
D) Variable connective

2
RJ
1.12 A loop designed to never end is called:

A) Sentinel loop
B) Counter-controlled loop
C) Infinite loop
D) Nested loop

1.13 Decrement operator ( - - ), decreases the value of a variable by what number?

A) 0
B) 2
C) 3
D) 1

1.14 Which one of the following expressions below is an example of a String data type?

A) “0”
B) ‘0’
C) [A] and [B]
D) None of the above

1.15 What is the extension for the acronym JVM?

A) Java Virtual Machine


B) Java Variable Machine
C) Java Virtual Mechanism
D) Java Variable Mechanism

1.16 Data values are stored in ___________ in a Java program.

A) methods
B) operators
C) numbers
D) variables

1.17 Invoking a method means:

A) Checking the method for errors


B) Designing the method
C) Asking a method to do its job
D) None of the above

1.18 Character data type cannot store the following value:

A) String
B) Special character
C) Letter
D) Digit

3
RJ
1.19 What is the output type of relational operators?

A) Integer
B) Boolean
C) Characters
D) Double

1.20 Every Java statement ends with a ___________ symbol.

A) Semicolon ;
B) Open brace {
C) Close brace }
D) None of the above

QUESTION 2: TRUE / FALSE (20 Marks)

Write down the number and then the answer, e.g. 2.21 True

2.1 A method can run without being called.


2.2 The keyword ‘void’ means no return type.
2.3 Any program can be written using sequence, selection and repetition.
2.4 The System.out.println() method is used to receive data from the keyboard.
2.5 Loops can be combined with decision structures.
2.6 Computer programming is giving a computer a set of instructions.
2.7 All variables must be declared before they can be used.
2.8 A computer can understand the Java programming language.
2.9 The Java Software Development Kit compiles and runs Java programs.
2.10 The Java program is enclosed in a class definition.
2.11 Algorithms are a sequence of steps that describe how a task is performed.
2.12 In Java, variable declarations do not have to include data types.
2.13 Every statement with if must also include else.
2.14 A variable cannot be accessed outside its scope.
2.15 To declare an integer variable, the keyword INT is used.
2.16 The value of the expression “10” + “10” is 20.
2.17 Java technology is both a programming language and a platform.
2.18 Debugging is the process of removing errors found in a program.
2.19 Syntax forms the rules of a programming language.
2.20 An application is a form of Java program that runs locally on the command line.

4
RJ
QUESTION 3 (20 Marks)

3.1 Java is a language which was developed in 1991 by a company called Sun Microsystems.

Briefly explain how Java works. (10 marks)

3.2 Provide FIVE (5) examples of high-level languages. (5 marks)

3.3 When you learn to program, mistakes will be made. Each time an error is made in a program; there is a
challenge of locating it.

Briefly explain TWO (2) types of errors. (5 marks)

QUESTION 4 (20 Marks)

4.1 Provide TWO (2) reasons for using comments in a program. (4 marks)

4.2 List and explain THREE (3) control structures. (6 marks)

4.3 Identify and correct the errors in the following statements:

4.3.1 String n = 10; (2 marks)

4.3.2 int radius = 24.5; (2 marks)

4.3.3 num1 + num2 = total; (2 marks)

4.3.4 JOption.showMessageDialog(null,Hello!) (2 marks)

4.3.5 char symbol = “Tom”; (2 marks)

QUESTION 5 (20 Marks)

5.1 Methods have a unique name and follow the same naming rules as variables; explain the rules for
naming methods. (5 marks)

5.2 Using a for loop, write a method called lines() to output the following statement to the screen 100 times: ‘I must
practise my programming’. Call the method lines() in the main program. (15 marks)

END OF PAPER

5
RJ

You might also like