0% found this document useful (0 votes)
27 views4 pages

Practice Questions - Comp

Uploaded by

tanbha12
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)
27 views4 pages

Practice Questions - Comp

Uploaded by

tanbha12
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/ 4

1.

Write pseudocode statements to declare the variables Cookie


and BagWeight
Cookie stores the brand name
BagWeight stores the weight of a cookie bag

2.An adventure sports company has a website. Customers can


book courses using an online booking form. The booking form
contains a number of fields. The following table gives a
description of the validation for each field. Write the validation
type for each validation description in the table.

3.A teacher researches the length of time students spend


playing computer games each day. The program should only
allow values from 0 to 300 inclusive as valid inputs. If the data
entered breaks this validation rule, an error message is
displayed.
a. Complete the following program to output "Invalid input" if
the data does not meet the validation rule
b.Complete the following test plan for the above program.

4. Complete the truth table for the following logic


expression:

X = NOT(A OR B) AND NOT(NOT(B OR C) AND (NOT


A))
4.An algorithm has been written in pseudocode to select a
random number using the function RandInt(n), which returns a
whole number between 1 and the argument n. The algorithm
then allows the user to guess the number.
Find the four errors in the pseudocode and suggest a
correction.

5. Write a program to implement linear search


6. Write a program to implement bubble sort
7. Create an integer 2D array called number with 10 rows
and 15 columns. Write a program to:
i. Input all the elements
ii. Find the average of all the elements in the array
iii. Find the largest element
8. Explain all the library routines (DIV, RANDOM, MOD,
ROUND) and string functions (UCASE, LCASE,
SUBSTRING, LENGTH)

9. A one-dimensional array dataArray[1:38] needs each


element set to negative 5.
10. A car manufacturing company gives each car model
type being manufactured from the first three letters of
the model in upper case, followed by the last 2 digits of
the year the car model was published.
For example, “mazda 6”, manufactured in 2012 would be given
the code MAZ12.

Write a pseudocode for a FUNCTION definition that will take


in the model name and year as PARAMETERS and return the
desired final code.

11. An algorithm will process data from a test taken by


a group of students. The algorithm will prompt and input
the name and test mark for each of the 27 students. The
algorithm will add the names of all the students with a
test mark of more than than 23 to a text file
Compile_List.txt. Describe the steps that the algorithm
should perform. Include pseudocode statements to
support your answer.

You might also like