Uploaded by mysuleman786

ISTN103 Logic Tutorial 2021

advertisement
ISTN Logic Tutorial – Semester 2 2020
1. Which of the following flowchart symbols represents a point in the process where
data is entered?
[A]
[B]
[C]
[D]
[E]
2. What allows program implementation to be independent of the characteristics of
the host CPU?
[A]
[B]
Machine language
An interpreter
[C]
[D]
[E]
Syntax
Natural language
None of the above
1
Questions 3 to 7 are based on the following flowchart:
Start
Input
Num
Count = 2, Sum = 0
Sum = (Sum + Count) * Num
X
Y
>=6?
Is Count
No
Count = Count + 1
Z
Yes
Output
Sum
End
3. What will the output of the flowchart be if the value of Num is 3?
[A]
[B]
[C]
[D]
[E]
300
600
900
200
100
4. How many times will Count = Count + 1 execute?
[A]
5
[B]
[C]
[D]
[E]
2
6
4
3
2
5. How many process boxes are there?
[A]
[B]
[C]
[D]
[E]
1
2
3
5
6
6. What structure is represented by X, Y and Z?
[A]
[B]
[C]
Termination
Repetition
Sequential
[D]
[E]
Conditional
None of the above
7. What will happen if the initial Count value changes from 2 to 7 and the Num value
is 4?
[A]
[B]
[C]
[D]
[E]
The output of the flowchart will be 28
The flowchart will stop at the decision point
Count = Count + 1 will never execute
Sum = (Sum + Count)*Num will execute twice
[A] and [C]
8. Which of the following is NOT part of phase 2 of the programming process?
[A]
[B]
[C]
[D]
[E]
User interface
Output
Subtasks
Major control structures
Logic
9. The correct sequence of the programming process is ________.
i)
ii)
iii)
iv)
v)
vi)
Define the problem
Develop the outline into an algorithm or flowchart
Test the algorithm or flowchart
Code the algorithm/flowchart and run the program
Document and maintain the program
Outline the solution
3
[A]
i), ii), iv), v), iii) and vi)
[B]
[C]
[D]
[E]
i), vi), ii), iii), iv and v)
ii), iv), vi), iii), v) and i)
iv), i), vi), v), iii) and ii)
iii), i), v), iv), ii) and vi)
Questions 10 and 11 are based on the following flowchart:
Start
Input
X= 0
Sum = 0
Y = Sum + X
Is Sum > 5?
Sum = Sum + 2
No
Yes
Output
Sum
End
10. The output of the flowchart is ________.
[A]
[B]
6
7
[C]
[D]
[E]
10
15
25
4
11. How many times will Sum = Sum + 2 execute if Input Sum value is changed to 2?
[A]
[B]
[C]
[D]
[E]
2
4
5
3
6
Questions 12 and 13 are based on the following flowchart:
12. The flowchart displays the sum of ________.
[A]
[B]
[C]
[D]
[E]
eight natural numbers
eight even natural numbers
eight odd natural numbers
four odd numbers
four even numbers
13. The output of the flowchart is ________.
[A]
[B]
10
16
[C]
[D]
[E]
18
20
25
5
Questions 14 and 15 are based on the following flowchart:
Start
C=0
Sum=0
Input
S
Sum=Sum+S
C=C+1
No
Is C = 25?
1
Yes
Average=Sum/25
Output
Average
End
14. What does the flowchart do?
[A]
[B]
It outputs the average of 25 numbers
It adds the values of 25 numbers
[C]
[D]
[E]
It calculates the average of 25 numbers
[A] and [C]
All of the above
15. What structure does item 1 form?
[A]
[B]
[C]
[D]
Process
Sequence
Condition
Input
[E]
Output
6
Questions 16 to 17 are based on the following flowchart:
Start
Input
F
C=5/9*(F-32)
1
Output
C
Another
value?
Yes
No
End
16. The flowchart converts degrees Fahrenheit to degrees Celsius. The symbols F
and C represent degrees Fahrenheit and degrees Celsius, respectively. If the
Input F is 40, what is the Output C?
[A]
[B]
[C]
[D]
[E]
4.4
10
15.6
21.1
25
17. What will happen if the end of the arrow labelled 1 were to move below Input F?
[A]
An infinite loop will occur
[B]
The system will do the conversion for the initial input and will not be able to
accept another input value
The system will output the value for C for each input
Nothing will change. The system will still do the conversion for each input
[C] and [D]
[C]
[D]
[E]
7
18. What will happen if the arrow labelled 1 were to be removed completely?
[A]
An infinite loop will occur
[B]
The system will do the conversion for the initial input and will not be able to
accept another input value
The system will output the values for F and C for the initial input only
Nothing will change. The system will still do the conversion for each input
[B] and [C]
[C]
[D]
[E]
19. A program error that violates the rules of a programming language is called a(n)
________ error.
[A]
[B]
algorithm
logic
[C]
[D]
[E]
syntax
language
processing
20. Which of the following elements signifies the start or end of a process?
[A]
[B]
[C]
[D]
[E]
21. Which of the following with regard to interpreters is/are true?
[A]
[B]
[C]
[D]
[E]
An interpreter can be tailored to a specific machine language, making
it simpler to implement
Program implementation is dependent on the characteristics of the host
CPU
When a program is interpreted, it runs more slowly than if it had been
compiled
[B] and [C]
None of the above
8
22. Software that interacts with the hardware of a computer system is called ________.
[A]
[B]
[C]
[D]
[E]
application software
system software
utility software
[B] and [C]
None of the above
23. A compiler converts a computer program into highly optimised machine code,
which provides the advantage of ________.
[A]
[B]
portability
platform independence
[C]
[D]
[E]
faster program execution
[A] and [B]
[B] and [C]
24. What should be placed in location S in the flowchart below if the
• input is 2, the output should be 16
• input is 3, the output should be 81
• input is 4, the output should be 256?
Start
Input
M
S?
Output
F
END
9
[A]
F=M*M*M*M
B]
M=F*F*F*F
[C]
[D]
[E]
F=M*M*M
F=M*8
G=M*M*M*M
10
Download