0% found this document useful (0 votes)
25 views11 pages

211 Revision

The document is a test paper for COMP 211, dated 8 Nov 2021, with a total of 30 marks and a duration of 2 hours. It contains multiple-choice questions covering topics related to high-level programming languages, algorithms, flowcharts, C programming functions, and variable operations. Students are required to answer all questions and provide their personal information at the beginning of the paper.

Uploaded by

ba23018846
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)
25 views11 pages

211 Revision

The document is a test paper for COMP 211, dated 8 Nov 2021, with a total of 30 marks and a duration of 2 hours. It contains multiple-choice questions covering topics related to high-level programming languages, algorithms, flowcharts, C programming functions, and variable operations. Students are required to answer all questions and provide their personal information at the beginning of the paper.

Uploaded by

ba23018846
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/ 11

COMP 211 TEST

8 Nov 2021 1600HRS


TOTAL MARKS 30
DURATION 2Hours

First name_____________________________________

Surname______________________________________ ID:________________________

Your Programme in Full_____________________________________________________________________

Please don’t forget to write down your programme, otherwise your paper can easily get lost.

Answer all questions in this paper,

1. Which of the following statement is false concerning high-level language?

a. A high-level programming language consists of a set of instructions.

b. A high-level programming language is represented by using simple English words

c. Examples of high-level programming languages are C, C++, and Java.

d. C programming is the only highly level language available.

2. A compiler is

a. a special program that converts the instructions into machine language.

b. a programming language

c. a computer program

d. A machine code

3. Which of the following is not a procedure needed to solve a problem, before writing a C
program?

a. Algorithm

b. Flowchart

c. Piechart

d. Pseudocode

Page 1 of 1
4. Which of the following statements is false about an algorithm?

a. An algorithm has fixed number of steps

b. An algorithm is a computer

c. Each step in an algorithm specifies the action to be performed.

d. The steps in an algorithm specify basic operations.

5. What function is used to get information from the keyboard in a C program.

a. printf()

b. scanf()

c. get()

d. scan()

6. What is a flowchart?

a. a graphical representation of an algorithm.

b. a C program code

c. a chart that shows C code

d. a C++ code

7. What does the following symbol represent in a flowchart;

a. Input

b. Processing

c. Output

d. Decision

8. Which of the following statements is false about a pseudocode?

a. A pseudocode is a detailed yet easy description of what an algorithm must do.

b. A pseudocode is a C programming code.

c. A pseudocode is written in a formally-styled English language.

d. Once the pseudo code is verified, it can be converted into a program using vocabulary
and syntax

9. Which of the following statements is true about variables in C?

Page 2 of 2
a. A variable is any combination of 1 to 31 alphabets, digits or underscores

b. The first character in a variable name must NOT be an alphabet

c. The first character in a variable name must NOT be an underscore

d. Commas and blanks are allowed in a variable name

10. Which of the following variable name is written correctly?

a. Hou_se

b. 2house

c. -house

d. Ho use

11. Which of the following is not a category of operators?

a. Arithmetic Operators

b. Logical Operators

c. Decimal Operators

d. Relational Operators

12. The AND logical operator is represented by which of the following?

a. &&

b. !

c. ||

d. ==

13. What is the output of the following code; a+=5 where a is 4.

a. 5

b. 3

c. 8

d. 9

14. What is the value of Y in the following code?

int x = 3;
y=x>1?3:4

Page 3 of 3
a. 3

b. 4

c. 2

d. 5

15. What does the expression a%b evaluate to given a=3 and b= 2?

a. 1.5

b. 12

c. 1

d. 0

16. What does the expression X*=2 evaluate to given X is 2?

a. 4

b. 0

c. 1

d. 2

17. What is the output of the following code;


#include<stdio.h>
void main()
{
int a = 1;
int b = 5;
if(a>b)
printf(“a is big”);
else
printf(“b is big”);

}
a. a is big

b. nothing will be displayed

c. an error will occur

d. b is big

18. What is the output of the following code?


#include<stdio.h>

Page 4 of 4
void main()
{
int i;
printf(“The output values are\n”);
for(i=1;i<=5;i++)
{
printf(“%d”,i);
}
}

a. 1

b. 12345

c. 54321

d. Nothing will be displayed

19. Which of the following is false about functions

a. A function is a self contained block of statements that perform a coherent task of some
kind

b. Some functions are system defined

c. Some functions are user defined

d. Printf() is an example of a user defined function

20. What is the output of the following code given that the user input the value of n as 3.
#include<stdio.h>
void main()
{
int i,n;
printf(“Enter the values for range”);
scanf(“%d”,&n);
i = 1;
while(i<=n)
{
printf(“%d”,i);
i = i +2;
}
}

Page 5 of 5
a. 123

b. 1 3

c. Nothing will be displayed

d. Non of the above

21. What is the output of the following code?

a. true

b. false

c. nothing will be displayed

d. an error will show

22. Which line of code in the C code below represents a function call?

a. calsum(int x, int y, int z);

Page 6 of 6
b. int d;

c. Return(d);

d. sum=calsum(a,b,c)

23. What is the output of the C code in question 22 given that the values of a=1,b=2 and c=3?

a. enter any three numbers sum value = 6

b. enter any three numbers d=x+y+z

c. The code will give an error

d. enter any three numbers

sum value = 6

24. What is the output of the following code if a=4 and b=6?

#include<stdio.h>
int sum(int a, int b);
void main() {
int a,b,x;
printf(“Enter the two integers”);
scanf(“%d%d”,&a, &b);
x=sum(a,b);
printf(“The sum of the numbers you entered is %d”, x);
}

int sum(int a, int b)

return (a+b);

Page 7 of 7
}

a. Enter the two integers The sum of the numbers you entered is 10

b. Enter the two integers The sum of the numbers you entered is, 10

c. Enter the two integers

The sum of the numbers you entered is, 10

d. Enter the two integers

The sum of the numbers you entered is 10

25. What type of a function is in question 24?

a. No return , No parameters

b. With return, No parameters

c. No return, With Parameters

d. With return, With parameters

26. What is the output of the following code given a=2 and b=4?

#include<stdio.h>

Page 8 of 8
a. enter the value of a and b, the final value = 6, enter the value of a and b, the final value = 8

b. enter the value of a and b

the final value = 6

enter the value of a and b

the final value = 8

c. enter the value of a and b the final value = 6 enter the value of a and b the final value = 8

d. enter the value of a and b, the final value = 6

enter the value of a and b, the final value = 8

27. What type of a function is in question 26?

e. No return , No parameters

f. With return, No parameters

g. No return, With Parameters

h. With return, With parameters

28. Which of the following are the two types of functions?

Page 9 of 9
a. Compiler defined and program defined

b. System defined and User defined

c. System defined and Compiler defined

d. User defined and Compiler defined

29. Which of the following is not an advantage of using functions?

i. Writing function avoids rewriting the same code over and over

j. Using functions, it becomes easier to write programs and keep track of what they are
doing

k. Makes the program easier to design and understand

l. Makes the code to compile faster

30. What is the output of the following code?

#include<stdio.h>
void rect();

void main() {
int k;
k=rect();
printf(“area of rectangle is = %d”,k);

void rect()
{

int l,b,a;
l=2;
b=8;
a=l*b;
return (a);
}

a. Area of rectangle is, 16

b. Area of rectangle is = 16

c. area of rectangle is = 16

Page 10 of 10
d. area of rectangle is =

16

Page 11 of 11

You might also like