+ All Categories
Home > Documents > COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF...

COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF...

Date post: 16-Mar-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
18
MOUNTAIN TOP UNIVERSITY COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF COMPUTER SCIENCE & MATHEMATICS SESSION: 2016/2017 Second Semester Examination COURSE CODE: CSC 102 CREDIT: 3 Units COURSE TITLE: Introduction to Algorithm Development DURATION: 60 Minutes INSTRUCTIONS: Answer all questions by choosing the correct option. 1. What is the value of the following literal? 0E1 a. 0 b. 0.1 c. 1 d. 0.01 2. Which of the following strings is a proper floating-point number (in the "C" language sense)? a. 3.14 b. .E13 c. 3.14E d. 210f 3. What is the value of the literal below? 0x1A a. 16 b. The literal is invalid c. 26 d. 6 4. Which symbol is used at the beginning of a flow chart? a.
Transcript
Page 1: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

MOUNTAIN TOP UNIVERSITY COLLEGE OF BASIC & APPLIED SCIENCES

DEPARTMENT OF COMPUTER SCIENCE & MATHEMATICS

SESSION: 2016/2017 Second Semester Examination

COURSE CODE: CSC 102 CREDIT: 3 Units

COURSE TITLE: Introduction to Algorithm Development

DURATION: 60 Minutes

INSTRUCTIONS: Answer all questions by choosing the correct option.

1. What is the value of the following literal? 0E1

a. 0

b. 0.1

c. 1

d. 0.01

2. Which of the following strings is a proper floating-point number (in the "C" language

sense)?

a. 3.14

b. .E13

c. 3.14E

d. 210f

3. What is the value of the literal below?

0x1A

a. 16

b. The literal is invalid

c. 26

d. 6

4. Which symbol is used at the beginning of a flow chart?

a.

Page 2: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

b.

c.

d. 5. Which symbol is used to test condition in a flowchart?

a.

b.

c.

d.

6. Consider the following flowchart. What value will it display?

a. 1

b. 2

c. No value is displayed

d. 0

Page 3: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

Use the following flowchart to answer Questions 7–9.

7. How many arithmetic steps does this flowchart have?

a. 1

b. 2

c. 3

d. 4

Page 4: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

8. In all, how many input and output steps does this flowchart have?

a. 0

b. 2

c. 3

d. 4

Page 5: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

9. Which of the following pseudocodes best corresponds to this flowchart?

a. Begin

Enter height of Christmas tree

Cost = height * 3.00

Cost = cost + cost x 0.05

Output cost

End

b. Begin

Enter height of Christmas tree

Cost = cost + tax

Output cost

Cost = height * 3.00

End

c. Begin

Enter height of Christmas tree

Cost = height * 3.00

Output cost

Tax = cost * 0.05

Page 6: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

Cost = cost + tax

End

d. Begin

Cost = height * 3.00

Tax = cost * 0.05

Cost = cost + tax

Output cost

End

10. Pseudocode uses _______ to express a program’s logic.

a. stepwise refinement

b. an object program

c. geometric symbols

d. English-like statements

11. In a flowchart, a decision step is represented by which of the following symbols?

a.

b. If-else

c.

d.

12. Which of the following is a typical processing instruction?

a. print answer

b. get password

c. average = totalNumber/count

d. display count

13. start

Get age

if(?) then

display " Teenager age"

endif

stop

Consider the code above. If age is between the range 13 and 19 then it will display " Teenager

age". which of the following statements can be replaced in (?) correctly?

a. age > 13 AND age < 19

b. age >= 13 AND age <= 19

c. age < 13 AND age >19

Page 7: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

d. age > 13 between age < 19

14. The structure in which you ask a question and depending on the answer, take some action

and then ask the question again, can be called all of the following except

a. repetition

b. loop

c. if-then-else

d. iteration

15. Machine language programs are written using _______.

a. English-like words

b. series of 1s and 0s representing high and low electrical states

c. BASIC

d. symbolic names to represent storage locations

16. Pseudocode uses _______ to express a program’s logic.

a. English-like statements

b. an object program

c. geometric symbols

d. stepwise refinement

17. If you used the formula length + width to calculate the area of a rectangle (when it should

be length * width), you would have made a _______ error.

a. debugging

b. syntax

c. pseudocode

d. logic

18. What is the output of the following program?

#include <stdio.h>

main() {

int i = 5, j = 0;

while(i > 0) {

i--;

j++;

}

printf( j);

return 0;

}

Page 8: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

a. 4

b. 2

c. 5

d. 3

19. What is the output of the following snippet if a digit 5 followed by Enter is entered

through from the keyboard?

int i;

scanf(“%d”, &i);

printf(“%d%x%d\n”, i , i + i, i);

a. 5a5

b. 5105

c. 5x5

d. i2i

20. What is the final value of variable k ?

int i = 3, j, k;

if(i > 0) j = 2 + i * i;

if(i <= 0) j = 2 * i - 1;

if(j >= 0) k = j % i + 2;

if(j < 0) k = i % j + 2;

if(k < 0) k = k % i % j;

if(k >= 0) k = j % i % k;

printf(”%d”, k);

a. 1

b. 2

c. 3

d. 0

21. The first stage in problem solving is_______

a. Performing step by step instruction

b. Program design

c. Problem definition

d. Program Testing

22. Which of the following properties of an algorithm gives the correct answer to a problem?

a. Finiteness

b. Effectiveness

Page 9: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

c. Output

d. Definiteness

23. In flowchart, __________ symbol hints the presence of a loop

a. Connector

b. Decision

c. Back arrow

d. Oval

24. _______ symbol is used to indicate a point in the algorithm at which a branch to one or

more alternative paths are possible

a. Process

b. Off-page Connector

c. Decision

d. Terminal

25. Which of the following cases does not exist in complexity theory?

a. Best case

b. Worst case

c. Average case

d. Null case

26. A variable name is also called _________

a. Constant

b. Declaration

c. Placeholder

d. Identifier

27. Which of the following is an example of a string?

a. “Hello”

b. 6549

c. 7

d. C

28. Which of the following is an assignment operator?

a. =

Page 10: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

b. *

c. ᴧ

d. %

29. The following Pseudocode is an example of a(n) _____________ structure

a. Sequence

b. Selection

c. Loop

d. Nested

30. What is the problem with this statement: 80 = sum ?

a. 80 should be in quotes

b. Data types do not match

c. Value on the left must be a variable name

d. 80 is not a valid number

31. The following pseudocode is an example of a(n) ________ structure

a. Sequence

b. Decision

c. Loop

d. Nested

32. The following Pseudocode can be re-written using a(n) _________ statement

get Amount IF Amount < 100

Interest rate = 0.06 Else

Interest rate = 0.10 ENDIF

Start Input Sum Set Average = Sum / 6 Output Average Stop

Page 11: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

a. While

b. Switch Case

c. Do-While

d. If-the else case

33. What is another name FOR LOOP structure?

a. Execution

b. Selection

c. Iteration

d. Case

34. Fill in the blank in this pseudocode

a. Then

b. While

c. Do

d. Else

35. In a(n) _____________ loop, the loop body continues to execute as long as the answer to

the controlling question is NO/FALSE

a. Do-until

b. Do-While

c. Continue

d. If-then-else

36. What symbol is used to represent output in a flowchart?

a. Parallelogram

b. Oval

c. Squares

d. Triangle

IF student’s grade is greater than or equal to 70

Print “A”

ELSE

If student’s grade is greater than or equal to 60

Print “B”

ELSE

If student’s grade is greater than or equal to 50

Print “C”

If student’s grade is greater than or equal to 45

Print “D

ELSE

Print “F”

IF < Condition> is true Then DO process 1 ------------- Do process 2

Page 12: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

37. What is the standard terminal symbol for flowchart?

a. Diamond

b. Triangle

c. Circle

d. Parallelogram

38. The Worst case occur in linear search algorithm when?

a. Item is somewhere in the middle of the array

b. Item is not in the array at all

c. Item is the last element in the array

d. Item is the last element in the array or is not there at all

39. Thing to keep in mind while solving a problem is

a. Input data

b. Output data

c. Stored data

d. a, b and c

40. Last step in stages of problem solving is _____________

a. Design a solution

b. Define a problem

c. Document the solution

d. Testing data

41. The ________ operator can be used to ensure that two conditions are both true before

choosing a certain path of execution

a. ||

b. &&

c. <<

d. ==

42. Every statement in a C Application ends with ___________

a. ,

b. ;

c. Stop

d. End

43. _____________ is a pre-processor directive that instructs the compiler to put code from

the header into a program before creating the executable.

a. #include

b. #define

c. Import.util

d. Scanf

44. Pseudocode is __________________

a. Another term for OOAD

b. A programing language used to display UML diagrams

c. A graphical representation scheme

d. An informal means of expressing program logic

Page 13: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

45. In some programing languages, programmer must write a variable _______ telling the

Compiler what type is expected of the variable.

a. Data type

b. Termination

c. Decision

d. Variable

46. A compiler is a translating program which

a. Translates low level instruction codes into machine language

b. Translates entire source program into machine language program

c. It is not involved in program’s execution

d. All of above

47. What does the following program print?

a. x: 0, 5, 15, 30

b. x: 0, 5, 15, 20

c. x: 0, 5, 10, 15

d. 0, 5, 10, 15

48. If the loop-continuation condition in a for header is initially ________, the program does

not execute the for statement’s body

a. True

b. False

c. Both True and False

d. None of the options

49. The following pseudocode reads a number from the user, multiply it by 5, and print the

result. What pseudocode statement should replace “?” to make the program functional

and structured?

int i, x = 0; printf("x: "); while(i< 20){ if( i% 5 == 0){ x = x + i; printf("%d , ", x); }

++i; }

Start

Get InputNumber

While not eof

Answer = InputNumber * 5

Print Answer

?

ENDWHILE

STOP

Page 14: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

a. If done then exit

b. Get InputNumber

c. Print InputNumber

d. No statement is needed

50. C language has __________ keywords.

a. 30

b. 45

c. 42

d. 32

51. #include is called

a. Preprocessor directive

b. Inclusion directive

c. File inclusion directive

d. None of the mentioned

52. C preprocessors can have compiler specific features.

a. true

a. false

b. Depends on the standard

c. Depends on the platform

53. C preprocessor is conceptually the first step during compilation.

a. true

b. false

c. Depends on the compiler

d. Depends on the standard

54. What is the output of this C code?

void main()

{

int k = 4;

float k = 4;

printf("%d", k)

}

a. Compile time error

b. 4

c. 4.0000000

d. 4.4

55. How many times will the “for loop” below be executed?

Page 15: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

#include<stdio.h>

int main()

{

int i=0;

for(;;)

printf("%d",i);

return 0;

}

a. 0 times

b. infinite times

c. times

d. 10 times

56. If you used the formula length + width to calculate the area of a rectangle (when it should be

length width), you would have made a _______ error.

a. logic

b. syntax

c. pseudocode

d. debugging

57. %f access specifier is used for

a. Strings

b. Integral types

c. Floating type

d. All of the mentioned

58. BASIC is _______.

a. a machine language

b. Beginner’s All-Purpose Symbolic Instruction Code

c. difficult to learn

d. useful only for writing business programs

59. Which of the following is not one of the steps in the programming process?

a. writing and documenting the program

b. defining and documenting the problem

c. designing and documenting a solution

d. printing the results

60. Programming languages that are more oriented toward the programmer, rather than the

computer are _______ languages.

a. assembly

b. machine

Page 16: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

c. low-level

d. high-level

61. What is the output of this C code?

int main()

{

j = 10;

printf("%d\n", j++);

return 0;

}

a. 10

b. 11

c. Compile time error

d. 0

62. A _________ is a pictorial representation of steps that should be followed to solve a problem

a. flowchart

b. connect

c. flow lines

d. algorithm

63. a process box is _____ in shape

a. Terminal

b. Rectangular

c. connector

d. oval

64. A ___ symbol is used to connect parts of a flowchart that are on different pages

a. rectangular

b. terminal

c. off-page connector

d. oval

65. _________ symbols are used to connect one box of flowchart to another

a. connector

b. flow lines

c. flowchart

d. card

66. The brain of any computer system is

a. ALU

b. Memory

c. CPU

d. Control unit

67. ASCII and EBCDIC are the popular character coding systems. What does EBCDIC stand for?

Page 17: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

a. Extended Binary Coded Decimal Interchange Code

b. Extended Bit Code Decimal Interchange Code

c. Extended Bit Case Decimal Interchange Code

d. Extended Binary Case Decimal Interchange Code

68. What is the size of an int data type?

a. 4 Bytes

b. 8 Bytes

c. depends on the system/compiler

d. cannot be determined.

69. A byte consists of

a. one bit

b. four bits

c. eight bits

d. sixteen bits

70. What is short int in C programming?

a. Basic data type of C

b. Qualifier

c. short is the qualifier and int is the basic datatype

d. a , b and C

Page 18: COLLEGE OF BASIC & APPLIED SCIENCES DEPARTMENT OF …mtu.edu.ng/mtu/oer/othersvideos/CSC102_2016_2017.pdfAnother term for OOAD b. A programing language used to display UML diagrams

Recommended