0% found this document useful (0 votes)
19 views2 pages

Revision Worksheet 8 Class Chapter 03

Revision work for class

Uploaded by

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

Revision Worksheet 8 Class Chapter 03

Revision work for class

Uploaded by

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

Army Public School & College Mangla Cantt

Revision: Solved Worksheet Chapter#03


Subject: Computer Science Class: VIII

Name: ____________________ Section: ________

Q.1: Fill in the blanks

i. A problem is an inquiry or a situation that under certain circumstances necessitates


research and logical thought to solve.

ii. Variables are containers for storing data values in the program.

iii. A function is a block of instructions used to perform a single task.

iv. In nCk, “n” represents number of the current row.

v. Turing’s Halting Problem will ask whether a computer program will stop or whether it will
keep running forever.

vi. Selection occurs when one of the two alternatives is chosen based on whether or not a
condition is true or false.

vii. All the games run in an infinite loop where the game keeps accepting requests from the
user until the user exits the game.

Q.2: Identify the mistakes and rewrite the correct formulas for finding the cell values in
Pascal’s triangle and find the element which is in 5th row and 3rd column of pascal’s triangle.

i. nCk = n! ii. arr[n][k] = arr[n-1][k+1] + arr[k-1][n]


(k+1)! k!
Correct formula: Correct formula:
nCk = n!
arr[n][k]= arr[n-1][k-1] + arr[n-1][k]
k! (n-k)!

n=5; k=3

nCk= 5!
3! (5-3)!

nCk= 5.4.3.2.1
3.2.1* 2!

nCk= 20
2.1

nCk= 10
Q.3: Identify the mistakes from the following syntax of given functions and correct them.

a) If (do activity) then (condition) c) while do (condition)


else (condition) while end
if end

if(condition) then (activity) while(condition) do (activity)


else (activity) end while
end if

b) for 1 to n d) function variable_name


for end // set of instructions

for i 1 to n function function_name


do something // set of instructions
end for end function

Q.4: Write the output of the following logical operators.


OR
AND
(If both conditions are false the
(If both conditions are true the output
output will be false and if one
will be true and if one condition is
condition is true the output will be
false the output will be false)
true)
Input 1 Input 2 Output Input 1 Input 2 Output

T T T T T T

T F F T F T

F T F F T T

F F F F F F

Q.4: Fill the empty cells of Pascal’s triangle and complete the triangle up to 4 rows.

1 1

1 2 1

1 3 3 1

1 4 6 4 1

You might also like