0% found this document useful (0 votes)
22 views9 pages

ASLevel CS MockModel Practicals Aug23

Uploaded by

Shanbagam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views9 pages

ASLevel CS MockModel Practicals Aug23

Uploaded by

Shanbagam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

1.

2.
i) The algorithm does not produce the correct result. Identify the error and mention its
type (2)

ii) Name the other two types of errors possible in any program code (2)

iii) Rewrite the algorithm to produce expected result. (2)

3. Study the following state transition diagram:

Check if the following binary inputs are accepted by the state machine: (2)
i) 110001
ii) 1010010
4. Study the following flow chart:

1. Trace the flow chart for the inputs A = 27 and B = 6 (5)

Answer Key to be deleted:


A B A>B Statement executed

27 6 Yes A=A-B
21 6
15 6
9 6
3 6 No B=B–A
3 3 No

What is the final output? (1)

5.

Identify the test data to be used to test your algorithm (3)

6. In a class of 15 students, their class teacher has recorded model marks in a table as shown
below:

Index Names M1 M2 M3 M4 Average


0 Aadhi
1 Bala
-----
-----

13 Shyam
14 Vishnu
i) Declare a 1-D array to store student names and another 2-D array for the marks. (3)
ii) Take input as student name and find the array index of the given student’s name. Write
pseudocode to return the index. If the given student name is not there in the array the
function should return -1. (4)

iii) Write a function to display the model marks from the 2D array. The function should take the
index as input and display the model marks along with average.
Note:
1. The display should be of the format as shown below: (4)
The model marks of the student are:
M1 – 50
M2 – 55
M3 – ab
M4 – 60
Average – 55
2. If a student is absent for the exam the teacher marks it with a -1 and this mark should
not be included for calculating the average.

iv) The model 3 marks of student name “Shyam” is to be added with 4 marks additional. Write a
single pseudo code statement to do the same. (1)
7. A small company uses text file to store the employee code and their basic salary details. The file
name is “Employeedetails.txt”.
Each employee detail is stored in a single line of the file and follows a standard format as shown
below:

“1041CPR17040MGR”

The first four characters specify the employee code and next three characters specify the
employee’s name in short form. The next five characters provide information on their basic
salary. The last three characters specify the position.

i) Write a pseudocode for function “ParseLine” which takes a string of the above format
and returns the employee code and his basic salary as return values.

................................................................................................................................................... ..........
......................................................................................................................................... ....................
............................................................................................................................... ..............................
..................................................................................................................... ........................................
........................................................................................................... ..................................................
................................................................................................. ............................................................
....................................................................................... ......................................................................
............................................................................. ................................................................................
................................................................... ..........................................................................................
......................................................... ....................................................................................................
............................................... ..............................................................................................................
..................................... ........................................................................................................................
........................... ..................................................................................................................................
................. ............................................................................................................................................
....... ................................................................................................................................................... ..
................................................................................................................................................. ............
................................................................................................................................. [5]

ii) The main part of the pseudocode has to be written to read all the employee details and
store it in a record array. Explain why a FOR loop cannot be used in this case. (1)
Explain which loop has to be used and write the pseudocode of the loop to be used. You
need to mention the loop to be used with the condition. (2)

iii) Write a pseudocode to read the file and read each line from the file into a string. Within
the loop, add code to call the above function and then display the employee code and
basic salary of the employee from the string. (4)

iv) Assuming that the company wants to now increase the basic pay of certain employees to
more than 5 digits and also, they want to add the full name o f the employee to be
stored in the file the current format is to be redesigned.

Explain how the file format has to be changed to cater to variable field length of data. (3)
8.
9. File management system of an operating system supports storage and retrieval of files from hard
disk. The system uses linked list ADT to store location addresses. Each node stores the fragment
location address and points to the next fragment. This is diagrammatically represented below:

The linked list can be implemented using two arrays as depicted below:

The file is now modified with additional data which is stored in block C and this block has to be
inserted between blocks B and D.

Modify the linked list structure to demonstrate the insertion. You need to modify the links in the
links of the node to depict the insertion.

Demonstrate how the arrays will be modified:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy