You are on page 1of 3

MID-EXAM: INTRODUCTION TO COMPUTER PROGRAMMING

SECOND YEAR MECHANICAL ENGINEERING STUDENTS (20%)

NAME:_____________________________________ID NO:_________________________

SECTION: ______________

COURSE TITLE: INTRODUCTION TO COMPUTER PROGRAMMING

COURSE CODE: MEng1052 Wednesday, Jan 16, 2019 TIME ALLOWED: 2:00 hrs.

BASIC INSTRUCTIONS:

1. WRITE YOU NAME AND ID BEFOR STARTING


2. SWITCH OFF YOUR PHONE
3. ANY KIND OF CHEATING ARE STRICTLY FORBIDDEN
4. USING ANY EXTRA PAPER IS NOT ALLOWED
INSTRUCTOR USE ONLY:

Parts Points TOTAL Gained


MARKS points

PART I. choice 1 Point each 10.

PART II. WORK 2 point each 10.

Sum 20.

GOOD LUCK!!!

Part I: Choose the best Answer. (10 %)

INTRODUCTION TO COMPUTER PROGRAMMING MEng1052 MID – EXAM-2 (20%)


1. A=10 or 00001010, B=13 or 00001101; what is the value of A & B?

A. 00001111 B. 11110000 C. 11110111 D. 00001000

2. C++ has strict rules for naming identifiers. Which one of the following is not correct about that rule?

A. identifier can be as long as you like. B. you can use uppercase and lowercase letters, and the digits.

C. the last character must be a letter or underscore D. none.

3. When a variable is assigned a value at the time of declaration, it is called ______

A. variable declaration B. variable initialization. C. Variable creation. D. all of the above.

4. Which one of the ff. is correct about Character (Char)?

A. are typically one byte in size. B. in C++, it is represented as any value inside a single quote.

C. is enough to hold 256 different values. D. all

5. Which one of the ff. is used to translate the source code into some intermediate form?

A. linker B. compiler C. editor D. none

6. Which one of the ff. is statement terminator?

A. semicolon B. Colon C. main D. Return E. Comma

7. All are true about comments except

A. Comments are parts of the source code disregarded by the compiler.

B. Is classified as line and block comments.

C. Used to read able/ understand the source code.

D. None

8.________ is a reserved memory location to store values.

A. value. B. name of variable. C. variable. D. none.

9. Which one of the ff. variables can be referred/accessed anywhere in the code, within any function, as
long as it is declared first?

INTRODUCTION TO COMPUTER PROGRAMMING MEng1052 MID – EXAM-2 (20%)


A. Local variable B. Global variable C. Inline variable D. Scope variable

10. __________ is a low level programming language in which a mnemonic is used to represent
instructions.

A. assembly language. B. machine language. C high level programming language D. source code

Part II: Answer the following question clearly (10%)


1. What is the output of the following program?

# include<iostream>

using namespace std;

int main()

{ int r, x=2, y=5; r= y%x; cout<<r;

return 0; }

A. 1 B. 2 C. 2.5 D. compile error

2. a. save it as a file (.cpp extension)


b. fix any error that you might have
c. using a text editor, write the program
d. compile and run

The algorithm for programming with C++ is listed above in question 1. Arrange it in correct order!.
Write only letters.

3. What is flow chart?


4. Write a C++ program that displays “Hello Students in WSU”.
5. X=1+3*4-6/2; find the value of X using Operators Precedence in C++. Show steps clearly.

INTRODUCTION TO COMPUTER PROGRAMMING MEng1052 MID – EXAM-2 (20%)

You might also like