Monday, 20 January 2014

Basic Questions and Answers

1.       A man bought an item for N5000 and sold it at a loss of 24%. Write a basic program to compute the item selling price.
ANSWER
REM program to compute item selling price
LET costP = 5000
Loss = (24/100)*costP
SellingPrice = costP – Loss
PRINT SellingPrice
End
2.       Describe the output that will be generated by the BASIC program below
LET x = 0
FOR I = 0 to 4
     FOR j = 0 to i-1
           LET k = (I + j -1)
           IF(k MOD 2 = 0) THEN
                LET x = x + k
           ELSEIF(k MOD 3 = 0)
     THEN
           LET x = x + k – 2
           ENDIF
           PRINT x
     NEXT j
NEXT i
END



ANSWER
1
J
X
0
0
NOT EXECUTABLE
1
0
0
2
0
0
2
1
2
3
0
4
3
1
5
3
2
9
4
0
10
4
1
14
4
2
20
4
3
20

3.       State the features that lead to the development of micro-computer and discuss the major components of one of the features
ANSWER
-          VLSI referred to as microprocessor
-          Semiconductors memories
-          Enhanced high level languages and operating systems
-          Optimization techniques in compiler
4.       What are the distinctions between RAM and ROM and discuss the disadvantages of primary memory that led to the introduction of secondary memory
ANSWER
Information stored in RAM cannot be retained permanently while that of ROM is not, RAM is the working memory while the content of ROM is used in carrying out power on switch test.
The disadvantages of primary memory is the limited storage capacity and cant retain information permanently

5         If you are given three sticks, you may or may not be able to arrange them in a triangle. For any three lengths “if any of the three lengths is greater than the sum of the other two, then you cannot form a triangle. Otherwise, you can.” Write a program that takes three integers as inputs and determine whether you can or cannot form a triangle from sticks with the given lengths.
ANSWER
INPUT “Enter the first length”, first
INPUT “Enter the second length”, second
INPUT “Enter the third length”, third
IF (first + second) < third THEN
     PRINT “you cannot form a triangle”
ELSE IF (first + third) < second THEN
     PRINT “you cannot form a triangle”
ELSE IF (second + third) < first THEN
     PRINT “you cannot form a triangle”
ELSE
     PRINT “Triangle can be formed”
END IF
END

3 comments: