Beaconhouse School System
Gulistan-e-Jauhar Campus
Topic: 1D Array
STUDENTNAME:________________________________DATE:____________________
Grade: 11 Section: ____________________________ Max. Marks:
10 Name of Array (N.O.A)= ______MyList___
20 Lower Bound=____1_______
30 Upper Bond= _____25_______
40 MyList[3] =_______20_______
25 MyList[5] = ____40__________
DECLARE N.O.A :ARRAY[ L.B : U.B] OF DATA TYPE
Declare MyList: ARRAY [1:25] OF INTEGER
___________________________________________________________________________
Write a pseudocode of a program in which input a number and stores it in an array at position 3.
OUTPUT “Input a number “
INPUT Number
MyList [3] ←Number __________________________________________________________________
___________________________________________________________________________
Construct an array of 564 elements and stores names in it which user will input.
DECLARE MyName: ARRAY [1:564] OF STRING
DECLARE Name, Count: STRING
FOR Count ← 1 TO 564
INPUT “Input name”, Name
MyList [Count]← Name
NEXT Count
There is already an array which contains numbers of 150 students.
Ask user to input search value and search at which position the searched value is stored.
N.O.A = Numbers
Output the position if search value is found or output “not found” if search value is not found.
Use linear search algorithm.
DECLARE Searchvalue, Index, Position: INTEGER
DECLARE Found: BOOLEAN
Index← 1
Found ← FALSE
INPUT “Enter the value you wish to search”, Searchvalue
REPEAT
IF Name[Index] = Searchvalue
THEN
Position ← Index
Found ← TRUE
END IF
Index← Index +1
UNTIL Found = TRUE or Index > 150
IF Found=TRUE
THEN
OUTPUT Position
ELSE
OUTPUT “Not found”
END IF
END IF
Write an algorithm to input 100 numbers. Output how many are positive, negative or zero.
DECLARE Count, Number, PosNum, NegNum, Zero : INTEGER
FOR Count ← 1 TO 100
INPUT “Enter Number”, Number
IF Number > 0
THEN
PosNum← PosNum + 1
ELSE
IF Number < 0
THEN
NegNum← NegNum +1
ELSE
IF Number= 0
THEN
Zero← Zero+1
ENDIF
NEXT Count
OUTPUT “Total positive values are”, PosNum “, total negative values are” NegNum, “and total number
of zeroes is “ Zero
Convert 19 into a Two's complement in 8-bit Integer
____00010011_______________________________________________________________________
___________________________________________________________________________
Convert -19 into a Two's complement in 8-bit Integer
_______11101101____________________________________________________________________
___________________________________________________________________________
Apply binary logical shift on 00000111 (3 places left)
____________00111000______________________________________________________________
___________________________________________________________________________
State the effect on original byte after logical shift.
____Equivalent to multiplying the binary number by 2
_______________________________________________________________________
___________________________________________________________________________