test2-answerscheme

8
Part A (10 Marks) 1. What is the prototype of a function pass that has a pass-by- value character parameter and a pass-by-reference integer parameter? The function DOES NOT return any value. A. void pass(char, int); B. void pass(char &, int); C. void pass(char, int &); D. void pass(char &, int &); 2. The ____________________ value specifies the position of an element of a component in an array. A. index B. function C. variable D. constant 3. Which of the following statements will set the value of the fifth component of the array beta to 88? A. beta[4] = 88; B. int beta[88]; C. cin << beta[88] << endl; D. beta[5] = 88; 4. Which of the following statements initialize each of the 5 elements of an integer array named numbers to 8? I. int numbers[5] = {8, 8, 8, 8, 8}; II. cout << numbers[5] = {8, 8, 8, 8, 8}; III. for(int j = 0; j < 5; j = j + 1) numbers[j] = 8; IV. for(int j = 0; j < 5; j = j + 1) cin >> numbers[j]; A. I and III B. I and IV C. II and IV D. I, III and IV 1

Upload: may-lee

Post on 26-Sep-2015

4 views

Category:

Documents


2 download

DESCRIPTION

jawapan test 2 2012 sem 2

TRANSCRIPT

Part A Objective

Part A (10 Marks)1.What is the prototype of a function pass that has a pass-by-value character parameter and a pass-by-reference integer parameter? The function DOES NOT return any value.

A. void pass(char, int);

B. void pass(char &, int);

C. void pass(char, int &);

D. void pass(char &, int &);

2.The ____________________ value specifies the position of an element of a component in an array.

A. index

B. function

C. variable

D. constant

3.Which of the following statements will set the value of the fifth component of the array beta to 88?

A. beta[4] = 88;

B. int beta[88];

C. cin