10th Computer Notes
10th Computer Notes
com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 1)
============================================================
SHORT QUESTIONS
Define Computer.
A computer is an electronic data processing device. It reads data processing and
produces results accurately at a very high speed.
What is a flowchart?
Flowchart is a diagrammatic representation of gorithm. It describes what operations
are required to solve a given problem.
Draw any four graphical symbols used in flowchart and explain them.
Flo chart symbols have specific meaning and are connected by arrows indicating the
flow from one step to another.
Flow line:
It is a line with arrow head. It is used to connect various flowchart symbols. It
indicates the flow of control.
Start/Stop Symbol:
It is a rounded rectangular shaped. It is used to indicate the start or end of a
flowchart. We can only write the words START or STOP inside this symbol. A flowchart
can only have one start but it may have many ends.
Input/Output Symbol:
============================================================
Visit www.easymcqs.com for Notes, Old Papers, Home Tutors, Jobs, IT Courses & more. (Page 1 of 7)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 1)
============================================================
It is represented by parallelogram. It indicate input or output operations. It contains
the word READ or INPUT along with the variables for input operation or PRINT for
OUTPUT along with the output data for output operation.
Processing Symbol:
It is represented by a rectangular block. It is used for data processing operation. All
the calculations appear inside the processing symbol, such as “SUM=A+B”. Variables
are also initialized inside the process symbol such as “K=1”.
Decision Symbol:
A decision or branching point. Lines representing different decisions emerge from
different points of the diamond.
LONG QUESTIONS
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 1)
============================================================
2) Analyzing the Problem:
The programmer investigates the problem and gathers as much information as
possible to find a solution. The following questions can be asked to analyze the
problem.
Is it possible to solve the problem on a computer?
What is to be done to find the solution of the problem?
What is the proper and what output is required?
How many solutions are possible?
Which solution is the best and why?
How solution will be implemented?
Write an algorithm to calculate the area of a rectangle for given breath and
length?
Step 1 Input the width (W) and Length (L) of a rectangle
Step 2 Calculate the area (A) by multiplying L with W
Step 3 Print A
Write an algorithm that inputs length in inches and calculate and prints it in
centimeters.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, Home Tutors, Jobs, IT Courses & more. (Page 3 of 7)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 1)
============================================================
Write an algorithm that inputs marks and prints the message “PASS” or
“FAIL”. Passing marks are 33.
Step 1 Input Marks (M)
Step 2 Check if (M<33) then Print “FAIL” GOTO Step 4
Step 3 ELSE Print “PASS”
Step 4 Stop
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 1)
============================================================
Write a Flowchart to calculate the area of a rectangle for given breadth and
length.
Flowchart for the area of a rectangle for given breadth and length:
Write a Flowchart to that inputs length in inches and calculate and prints it
in centimeters.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, Home Tutors, Jobs, IT Courses & more. (Page 5 of 7)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 1)
============================================================
Write a Flowchart to that inputs marks and prints the message “PASS” or
“FAIL” Passing marks are 33.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, Home Tutors, Jobs, IT Courses & more. (Page 6 of 7)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 1)
============================================================
============================================================
Visit www.easymcqs.com for Notes, Old Papers, Home Tutors, Jobs, IT Courses & more. (Page 7 of 7)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 2)
============================================================
SHORT QUESTIONS
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 1 of 8)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 2)
============================================================
A variable is a symbolic name that represents a value that can change during
execution of a pr gram.
A variable has a name, known as variable name and it holds data of other
types. A number or any other type of data held in a variable is called its value.
It has follo ing types:
i. Numeric variables:
Numeric variables are used to represent numeric values in computer
programs. They represent integer and floating-point values. Some
examples of numeric variables are sum, average, length, salary, marks,
etc.
ii. Character variables:
Character variables represent character values in computer programs. It
can represent a single character or a string of characters. Some example
of character variables are name, city, gender, etc.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 2 of 8)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 2)
============================================================
Which of the following are valid C variables? Give the reason if not a valid
variable area, 5x, Sum, net pay, float, _age, else, case, size22, my_weight?
Valid Variables:
My_weight
Area
size22
Sum
Not Valid Variables:
5x A variable can‟t be start with number
Net pay Space can‟t be used in variable name
Float Data types can‟t be used in variable name
_age Special character ( ) can‟t be used in variable name
Else Commands cannot be used as variable name
Case Commands cannot be used as variable name
What are reserved words? Why they should not be used as variable names.
The words that are part of programming language a d have special purposes in
computer programs are called reserved words or keywords.
They have predefined use and cannot be used for any other purpose.
These are always written in lowercase.
There are 32 words defined as reserved words in C which are as under:
RESERVED WORDS
Auto double Int Struct
Break Else Long Switch
Case Enum Register Teepee
Char Extern Return Union
Const Float Short Unsigned
Continue For Signed Void
Default Goto Sizeof Volatile
Do If Static while
Typecasting is a method to convert a variable from one data type to another data
type during program execution.
For example, a variable of type int can act as a variable of type char using
typecasting.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 3 of 8)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 2)
============================================================
For example, a one use for typecasting is when there is need to produce ACII
characters for decimal codes (0-127). To do this, the programmer will need format
specifier %c.
There are two types of typecasting in C.
o Implicit typecasting
o Explicit typecasting
LONG QUESTIONS
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 2)
============================================================
Visual Basic:
Visual Basic (VB) is a high level language which evolved from the earlier version
called BASIC.
BASIC stands for Beginner‟s All-purpose Symbolic Instruction Code.
Interpreter translates high level language programs into machine language but it
translates one instruction at a time and executes it immediately before translating
the next instruction.
Examples of programming languages that use interpreter are Java script, BASIC,
Visual Basic and Perl.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 5 of 8)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 2)
============================================================
Interpreter reads each statement of source program, one at a time and determines
what it means as it executes it.
It means each time a statement is read, it must be translated into machine
language before execution.
What is the difference between implicit type casting and explicit type
casting? Give examples.
Typecasting is a method to convert a variable from one data type to another data
type during program execution.
For example, a variable of type int can act as a variable of type char using
typecasting.
For example, a one use for typecasting is when there is need to produce ACII
characters for decimal codes (0-127). To do this, the programmer will need format
specifier %c.
There are two types of typecasting in C.
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 2)
============================================================
Suppose an expression contains variables of integer and double data types, the
result will be evaluated to a double data type.
For example in the program given below, compiler converts the sum of two float
numbers to an int.
#include<stdio.h>
void main(void)
{
float value1 = 2.5;
float value2 = 5.3;
int result;
result = value1 + value2;
printf(“Result : %d”, result);
}
Explicit Typecasting:
Explicit casting is performed by programmer.
The programmer explicitly defines the data type in pare thesis before the variable
or expression, as follows:
(type) expression
For example in the program given below, the programmer converts division of two int
numbers to float.
#include <stdio.h>
Void main(void)
{
Int value1 = 30;
It value2 = 7;
Float result;
Result = (float)value1 / va ue2;
Printf(“Result : %f”, result);
}
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 2)
============================================================
For example when we include stdio.h in any program, it tells the C compiler to
copy the stdio.h header file into the program. The stdio.h header file stand for
standard input-output header. It includes the standard prindf() and scanf()
function prototypes. In the above program the printf() function is used.
Therefore, it is required to include this header file in the include preprocessor
directive.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 8 of 8)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 3)
============================================================
SHORT QUESTIONS
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 1 of 10)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 3)
============================================================
The output of the program is shown in Fig.
In this program, the format specifier %s is used to print the string stored in the
variable name. The execution f this is shown in Fig.
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 3)
============================================================
The program in Fig below reads a single character the instant it is typed and
displays it on the screen. The user does not have to press the Enter key after
typing the letter.
In this program, the getche() function reads a single charac r from the keyboard
and it is assigned to the variable ch. The format specifier %c is used to print the
letter stored in variable ch. The execution of this program is shown in Fig.
The getch() is a similar function to getche(), the difference is that it does not
display the typed character t other s reen. The getche() and getch() functions
require conio.h header file, so it must be in luded in the program as well.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 3 of 10)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 3)
============================================================
Ans: Output:
Z1 = 3
Z2 = 2
Z3 = 18
Z4 = 5
Ans: Output:
C= 7.840000
D = 2.120000
E = 6.160000
F = 10.920000
LONG QUESTION
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 3)
============================================================
Variable = expression
Where expressions may be a constant, another variable to which a value has
previously been assigned or a formula to be evaluated. For example:
Sum = a + b;
Variable op = expression
This is equivalent to:
Sum = sum + n;
This assignment statement could be written u ing a compound assignment
operator as:
Sum += n;
The effect is exactly the same but the expression is more compact. Some more
examples are:
A) Relational Operators:
These are used to compare two values of the same type.
These are used in expressions when a decision is to be based on a condition.
After evaluation of a relational expression, the result produced is either True of
False.
Relational operators are used in programming for decision making.
There are six types of relational operators in C language. These are described in
table below:
Operator Definition
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 5 of 10)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 3)
============================================================
== Equal to
!= Not equal to
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
B) Logical operators:
Logical operators are used for building ompound conditions.
A single condition is built using a relational operator in an expression.
If we need to build more th n one condition for some action to take place
programming, then we have to form compound condition.
They have following types:
Operator Definition
&& AND
|| OR
! NOT
Syntax
Expression1 && Expression2
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 3)
============================================================
This expression is considered true if both conditions (a>=1) and (a<=1) are true,
that is, if the value of a is between 1 to 10.
In the next example, the compound condition is considered true if the value stored in
a is greater than the value stored in b and the value stored in c is equal to 15.
(a>b)&&(c==15)
The following compound condition will check whether the charac r stored in variable
ch is a lowercase letter or not.
(ch>=‟a‟)&&(ch<-„z‟)
The compound condition is true if either of the conditions is true or both conditions
are true. It is considered false only if both of the conditions are false.
Syntax:
Expression1|| Expression2
Example:
(n<10)||(n>25)
Suppose, the value of n is 5, then the expression will be considered true because one of
the t o conditions is true if the value of n is 28 then also the compound condition ill be
true. If the value of n is 12 then the expression will be false since both
conditions are false.
The next compound conditions will be true if a is greater b or c is equal to 10. It will
also be true if both conditions are true, that is, a is greater than b and c is not equal
to 10.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 7 of 10)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 3)
============================================================
(a>b) || (c==10)
Logical OR condition is used when we wish to perform an operations if one of the two
conditions is true or both of the conditions are true.
Syntax:
!Expression1
When this statement is executed, the condition is evaluated. If it is true, the entire
conditional expression takes n the value of expression1. If it is false, the expression
takes on a value and can theref re be used in assignment statements. Consider the
following example.
A= (k>15)? x*y : x+y;
This statement will assign the product of x and y to the variable a, if k is greater than
15, otherwise a will be assigned the sum of x and y. this expression is equivalent to
the following if-else statement which will be explained in the next unit. If (k>15)
A = x*y;
Else
A = x+y;
Some programmers may prefer to use the above if-else statement rather than using
the conditional operator because it is easy to understand.
The program in Fig, demonstrate the use of conditional operator for finding the larger
of two numbers.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 8 of 10)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 3)
============================================================
Write a program that reads three numbers and prints their sum, product and
average.
#include <stdio.h>
int maint()
{
int num1, num2, num3, sum, prod, avg;
printf(“Enter the three numbers separated by „,‟\n”);
scanf(“%d, %d, %d, & um1, &num2, &num3); sum
= num1 + um2 + um3;
prod = num1 * num2 * num3;
avg = sum/3;
prinf(“the sum f the three numbers is : %d\n”,sum);
printf(“the pr d f the three numbers is : %d\n”,prod);
printf(“the average of the three numbers is : %d\n”, avg);
}
Write a program that reads the length and width of a rectangle and prints its
area.
#include <stdio.h>
main()
{
float length, width, area;
printf(“Enter length of rectangle:”);
scanf(“%f”, &length);
printf(“Enter width of rectangle:”);
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 9 of 10)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 3)
============================================================
scanf(“%f”, &width);
area= length*width;
printf(“Area of rectangle - %f sq. units “,area);
}
Write a program that reads the length of one side of a cube and prints its
volume.
#include <stdio.h>
#include <conio.h>
main()
{
float side, volume;
printf(“Enter length of any side of cube\n”);
scanf(“%f”, &side);
printf(“Volume of Cube: %0.4f\n, volume);
}
Write a program that reads name and address of a person and prints it on
the screen using gets() and puts() functions.
#include <st io.h>
#include <string h>
int main()
{
char name[50], add[50];
printf(“Enter your name:”);
gets(name);
printf(“Enter your address:”);
gets(add);
printf(“Your name is:”);
puts(name);
printf(“Your address is:”);
puts(add);
}
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 10 of 10)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 4)
============================================================
SHORT QUESTIONS
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 4)
============================================================
break;
.
.
.
default:
statements;
}
The switch statement is similar to the else-if statement. It is used when multiple
choices are given and one choice is to be selected.
Program:
When this program is executed, it reads an integer number, stores it in the
variable n and then the condition (n>0) is evaluated.
If it is true, it prints the message that the entered number is a positive number
and then the nested if-else statement is exe uted.
The nested if-else statement prints whether n is an even number or an odd
number.
If the condition (n>0) is false then the statements following the first if are skipped
and the last statement after the else is executed which prints the message that the
user entered a negative number r zero.
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 4)
============================================================
Ans: Count = 10
Sum = 58
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more (Page 3 of 7)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 4)
============================================================
LONG QUESTION
Use of If Statement:
Program 1: The program in Fig, demonstrates the use of if statement.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more (Page 4 of 7)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 4)
============================================================
Structure Of If-Else Statement:
The if-else statement is used in situation hwre some code is to be executed if a
condition is true and some other code is to be executed if the condition is false. The
if-else statement has the following general form.
if (condition)
{
Block of statements
}
else
{
Block of statements
}
When if-else statement is executed. The condition is evalua d.
If the condition is true then the block of statements f ll wing if will be executed
and the block of statements following else will be skipped.
If the condition is false then the block of stateme ts following if will be skipped and
the block of statements following else will be executed.
If a single statement is to be executed after if or else then braces are not
required.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more (Page 5 of 7)
www.parahii.com
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 4)
============================================================
When this statement is executed, contion-1 is evaluated, if it is true then the block
of statements following if is executed and if it is false, the next condition is
evaluated.
If any condition is true then the following block of statements is executed.
If none of the conditions is true then the block of statements following else is
executed automatically.
If a single statement is to be executed after if, else-if or else, instead f set of
statement then the braces are not required.
Switch Statement:
The switch statement has the following general form.
Switch (expression)
{
Case const-1;
Statement;
Break;
Case conts-2;
Statements;
Break;
.
.
.
Default:
Statements;
}
The switch statement is simi ar to the else-if statement. It is used when multiple
choices are given and o e ch ice is to be selected.
TH
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 4)
============================================================
Purpose of switch statement:
The switch statement is similar to the else-if statement. It is used when multiple
choices are given and once choice is to be selected.
When switch statement is executed, the expression is evaluated. Based on the
result of expression one of the cases in the switch statement is executed. The
result of expression is compared with the constant values given after the key word
case. If the result matches the constant value after any case then the statements
under that case are executed.
In switch statement, it is allowed to use a variable within the parenthesis instead
of an expression based on which statements under a case can be executed.
The purpose of break statement is to exit the body of the switch statement after
executing the statements under a case and transfer con rol o he first statement
following the end of the switch statement.
If no case is matched then the statements u der the default keyword are
executed. Its use is optional if it is not used then the co trol exits from the body of
the switch statement and goes to the fir t tatement following the end of the
switch statement.
The expression should be of type int, ch r but not float.
When this pr gram is executed, the switch variable must have an integer value.
The value of switch variable n is compared with the constant values statements
following that particular case.
If the s itch variable does not match any of the case constants, control goes the
key ord default which is at the end of the switch statement.
Notice the use of break statement in this program. It terminates the switch
statement when the body of the statements in a particular case has been
executed.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more (Page 7 of 7)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 5)
============================================================
SHORT QUESTION
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 5)
============================================================
LONG QUESTIONS
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 2 of 8)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 5)
============================================================
Note: All the three expressions such an initi iz tion, test condition and increment are
optional. You can omit any or all in for statement.
Example: For example the following all for statement are valid.
For(; ;)
For(int i=1 ; ;)
For(l k<10 ; k++)
For(; ; k++)
For(: x<12 ;)
Explain while and do-while loops with examples.
While loops/ The While Statement:
A repetition structure hen the number of iterations is not known in advance and the
repetition continues until test condition remains true. The while statement has the
general form:
while (test con ition)
{
Body of the loop
}
When a while statement is executed, the computer first evaluates the test
condition. If it is true, body of the while loop is executed. After the execution of
the body of the loop, the test condition is again evaluated and if it is true, the body
of the loop is executed once again. This process continues until the test condition
statement following the end of the body of loop.
The body of the loop can be a single statement or it can be multiple statements. If
the body of the loop consists of a single statement then the braces are not
required but if it consists of more than one statement then braces must be used.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 3 of 8)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 5)
============================================================
Examples:
Program: The program in Fig. prints all the upper-case letters are in the range 65 to
90.
do
{
Body of the loop
}
While (test conditio );
The statement while (test co dition) is placed at the end of the loop so that the
body of the loop is executed at least once whether the condition is true or false.
There is a semic l n after the test condition because it is at the end of loop if the
body of loop c ntains a single statement then braces are not required.
Program:
The program in Fig. prints all the lower-case letters of the alphabet using do while
loop. The ASCII codes for the lower-case letters are in the range of 97 to 122.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 4 of 8)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 5)
============================================================
The output of this program is shown in Fig.
In this program, the integer variable n is initialized to 97 which is the ASCII value
of letter a, before entering the loop.
The expression in the do while statement, n<=122 acts as the test ondition. The
statement within the loop execute as long as this expression remains true.
The statement n=n+1 increments the value of n by one with ach iteration. Note
that the ASCII value of z is 122.
Explain the purpose of Break and continue stateme ts with one example
each.
The Break Statement:
C language provides the break statement to exit from a loop as soon as certain
condition occurs. It is used in for, while and do while statements. Break statement
is also used to exit the body of switch st tement after executing the statements
under a case and transfers control to the first st tement following the end of the
switch statement.
The Continue Statement:
Sometimes during the execution of loop, when a certain condition occurs after
executing a statement, it may be required to skip the remaining statements within
the body of the loop and continue l p for next iteration until the test condition in met.
C language provides the c tinue statement to achieve this task. The continue
statement causes the loop to be continued with the next iteration after skipping the
remaining statements ithin the body of the loop. The general format of continue
statement is:
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 5 of 8)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 5)
============================================================
When the above program is executed, it reads a number and determines whether
it is a prime number or not. The integer variable a is assigned the value 0 to
assume that the number num is a prime number.
The remainder operator (%) is used inside the for loop to check if the number is
exactly divisible by any number in the range 2 to num/2.
If the number is exactly divisible by any number in the range 2 to nu /2 that
means it is not a prime number. This is checked, with the condition num%k==0.
If this condition is true, the variable a assigned the value 1, indicating that num is
not a prime number.
At this point, the break statement is used to exit the for loop immediately. After
the execution of the for loop, the value of a is checked, if it is 0 th n the message
telling the user that num is a prime number is printed h rwise the message, num
is not a prime number is printed.
Program to read 10 numbers and find the sum of those that are less than 20
by using continue statement:
When the program is executed, the user enters 10 numbers one by one.
If a number less than 20 is entered, the condition of if statement is false and the
number is added in the sum.
If a number greater than or equal to 20 is entered, the number is not included in
the sum as the condition is true and the last statement of the loop that adds the
number, is skipped using the continue statement.
After ten iterations the loop terminates and the last statement of the program
prints the sum of those numbers that are less than 20.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 6 of 8)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 5)
============================================================
The loop variable j is assigned its initial value 1 and the nested
loop For (k=1; k<=4; K++)
{
prod = j*k;
printf(“\n%2d × %2d = %2d”, j, k, prod);
}
If executed, this calculates and displays the first four pr ducts, 1×1, 1×2, 1×3 and
1×4.
The value of j is then incremented by 1 and the inner loop is executed again. This
calculates and displays the next four product , 2×1, 2×2, 2×3 and 2×4.
Finally, j is incremented to 3, giving the st four products, 3×1, 3×2, 3×4 and 3×4.
In this program braces must be used in the inner for loop because there is more
than one statement to be executed.
Example # 2:
Program uses nested loop to calculate the sum of the integers for each
integer from 1 to n, where is the value that the user of the program enters:
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 8 of 8)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 6)
============================================================
SHORT QUESTION
A Boolean function can be transformed from an algebraic expression into a logic circuit
composed for AND, OR and NOT gates.
A Boolean function is an expression formed with binary variabl s, he logical operators (OR,
AND and NOT), parenthesis and equal sign.
All binary variable can take the value of 0 or 1.
For a given value of the variables, the function can be either 0 r 1.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 1 of 6)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 6)
============================================================
Rules for simplifying a three-variable K-map:
For each term of the function, place 1 in the corresponding cell in Karnaugh map.
Form groups of four if possible otherwise groups of two.
Groups can contains only 1s.
Groups can be horizontal or vertical.
Groups can overlap and wrap around the side of the K-map.
If possible include each 1 in at least one group.
Eliminate the variables that are normal and complemented form in a group and create a
term for each group.
Write the simplified function in the form of sum of terms. If a cell containing a 1 ann t be
included in any group then write the full term with three variables.
LONG QUESTIONS
Draw the graphical symbols of AND, OR, NOT, NAND and NOR ga s and write their
functions.
There are three basic logic gates used in digital circuits which are AND< OR and NOT gates.
AND GATE:
The AND gate has two or more inputs that can be LOW (0) or HIGH (1).
The output is HIGH only when all the inputs are HIGH.
It produces a LOW output when at least one of the inputs is LOW.
The logic operation of a two-input AND gate is shown in Fig, with all the possible input
combinations and the resulting output for ea h.
OR Gate:
The OR gate has t o or more i puts, the output of an OR gate is LOW only when all the
inputs are LOW.
The output is HIGH hen one or more of its inputs are HIGH
The logic operati n f a t o-input OR gate is shown in Fig, with all the possible input
combinations and the resulting output for each.
NOT Gate:
The NOT gate performs the functions of inversion. Therefore, it is also known as inverter.
It has a single input.
The output of a NOT gate is HIGH when the input is LOW and vice versa.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 2 of 6)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 6)
============================================================
NAND Gate:
The NAND gate combines the AND and NOT gates, such that the output will be 0 only
when all the inputs are 1 as shown in Fig.
Its logic expression is F = xy which indicates that inputs x and y are first ANDed and then
the result is inverted. Inversion is indicated by a bar.
Thus, an AND gate always produces an output that is the inverse (opposite) of and AND
gate.
Explain how NAND and NOR gates can be created using AND, OR and NOT gates.
Creating NAND Gate Usi g Basic Gates:
The NAND gate can be easily created by using an AND gate and a NOT gate as shown in Fig.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 3 of 6)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 6)
============================================================
X Y Z ¯x ¯y ¯z x¯z ¯x¯y F4
1 1 1 0 0 0 0 0 0
1 1 0 0 0 1 1 0 1
1 0 1 0 1 0 0 0 0
1 0 0 0 1 1 1 0 1
0 1 1 1 0 0 0 0 0
0 1 0 1 0 1 0 0 0
0 0 1 1 1 0 0 1 1
0 0 0 1 1 1 0 1 1
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 4 of 6)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 6)
============================================================
Simplify the Boolean functions of Question 5 using Karnaugh map.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 5 of 6)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 6)
============================================================
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 6 of 6)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 7)
============================================================
SHORT QUESTION
Web Server:
A Web server is a computer that makes Web pages available through the internet.
Web servers are used to host websites, data storage and for running applications.
Web servers deliver HTML documents when a user types a URL in browser.
Any computer can be turned into a Web server by installing server software and
connecting it to the Internet.
Describe HTML.
HTML is a mark-up language use to create Web pages.
A browser such as internet Explorer or Google Chrome is used to read HTML
document and display it on the screen as Web pages.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 1 of 6)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 7)
============================================================
Hypertext Mark-Up Language:
LONG QUESTION
2) News Websites:
News websites provide informati n about current events and opinions.
These sites publish news stories and let their visitor’s voice be heard.
These sites provide their visitors a way to get their thoughts and views published.
Very often at the end of news stories, visitors are asked to share their experience
or knowledge ab ut the topic.
Therefore, a link f r the readers comment is provided for feedback.
For example www.paktribune.com, www.dailytimes.com etc.
3)
Information Websites:
Information ebsites provide information on any topic in the form of text, graphics,
sounds and videos.
For example, www.wikipedia.org is an informational website that provides
information on thousands of articles.
It allows users to contribute and edit articles as well.
4) Educational Websites:
Educational websites are created for educational purpose.
These sites contain animation, slide presentation and tutorials to educate people
on various topics, information is presented in a very well organized way.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 2 of 6)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 7)
============================================================
The purpose of any educational website is to impart knowledge to people who are
looking for better understanding of a topic and pursue knowledge.
For example www.easymcqs.com etc.
i) Paragraph:
The <p></p> tags are used to define paragraph. HTML aut matically adds an extra
blank line before and after a paragraph.
ii) Heading:
There is six heading tags, <h1></h1> to <h6></h6>. The <h1></h1> tags are
used to specify the largest heading and <h6></h6> t gs specify the smallest.
iii) Bold:
Bold <b></b>
These tags will make the text bold th t is within the tags.
For example: <b>Chapter 5 Output Devices</b>
iv) Underline:
Underline <u></u>
These tags will underline the text that is within the
tags. For example: <u>Please Note:</u>
v) Italic:
Italic <i></i>
These tags are used to make the text italic that is within that tags.
For Example: <i>I Love Pakistan</i>
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 7)
============================================================
For Example: <strike>Obsolete Computer Devices</strike>
viii) Superscript:
Superscript <sup></sup>
These tags are used to convert the text to superscript that is within the tags.
For example: X<sub>Y</sub>
ix) Subscript:
Subscript <sub></sub>
These tags are used to convert the text to subscript that is within the
tags For example: X<sub>5</sub>
Describe how background color and image are applied to Web page.
To apply a background color in a page, insert the background color attribute and
for foreground color, insert text attribute in the <body> tag as shown in Fig.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 4 of 6)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 7)
============================================================
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 5 of 6)
www.parahii.com
th
COMPUTER SCIENCE FOR 10 CLASS (UNIT # 7)
============================================================
The space between the cells and also the space between the text and the border of
the cells has decreased to default values.
In the HTML document, the code for creating the he ding of each column of second
row is given as below.
<tr>
<td>S.No</td>
<td>Date</td>
<td>Class IX</td>
<td>Class X</td>
</tr>
The text of all the four cells of second row is within the <tr></tr> tags and the
text of each cell is within the <td></td> tags. The text of the next three rows is
also defined in the same ay.
The code for the first r w that contains the title is:
<tr>
<td colspan=4 align=center>
<b>FINAL EXAMINATIONS 2011-
2012</b></td> </tr>
Here, the colspan attribute is used to combine the four columns and the align
attribute centers the table. The user can also use the rowspan attribute to combine
the cells of rows of a table. The align attribute is used to align the title in the center
of the row. Title can also be aligned to the left or right.
============================================================
Visit www.easymcqs.com for Notes, Old Papers, PDF, IT Courses & more. (Page 6 of 6)