10th Class Computer Chapter 3 Urdu Medium
Important full 10th Class Computer Chapter 3 Urdu Medium of Conditional Logic in 10th Class Computer Science Urdu Medium written by Honorable Mr. Wajid Ghani Suib. These computerized notes are very helpful in the preparation of 10th Class Computer Chapter 3 Urdu Medium for students of the 10th class Computer Science and these are according to the paper patterns of all Punjab boards.
Summary and Contents:
Topics which are discussed in the notes are given below:
- Important Multiple Choice Questions ( MCQs ) with correct Answers of Chapter No. 3: Conditional Logic in Computer Science class 10th Urdu Medium.
- Important Short Questions with Correct Answers of Chapter No. 3: Conditional Logic in Computer Science class 10th Urdu Medium.
- Students Learning Outcomes After completing this unit students will be able to
- Define a control statement
- Define a selection statement
- Know the structure of if statement
- Use if statement
- Know the structure of if-else statement
- Use nested selection structures
- Unit Introduction: In our daily life, we often do certain tasks depending upon the situation e.g. I will go for a walk if I wake up at 6 am. If the weather turns cloudy, I will take umbrella with me. If Sara passes the exam, I will gift her a watch. All these decisions are taken on the basis of condition. If the condition is true, we perform the specified task, otherwise we do not. Sometimes, if the condition is not true then we perform some other task. This is called conditional logic. In this chapter, we discuss how to implement conditional logic in C programming language.
- Control Statements: In order to solve a problem, there is a need to control the flow of execution of a program. Sometimes we need to execute one set of instructions if a particular condition is true and another set of instructions if the condition is false. Moreover, sometimes we need to repeat a set of statements for a number of times. We can control the flow of program execution through control statements. There are three types of control statements in C language.
- 1- Sequential Control Statements, 2- Selection Control Statements, 3- Repetition Control Statements
- Sequential control is the default control structure in C language. According to the sequential control, all the statements are executed in the given sequence. Till now, we have just worked according to the sequential control. In this chapter, our focus is on the selection control statements.
- Selection Statements: The statements which help us to decide which statements should be executed next, on the basis of conditions, are called selection statements. Two types of selection statements are: 1. If statement, 2. If-else statement
- If Statements: C language provides if statement in which we specify a condition, and associate a code to it. The code gets executed if the specified condition turns out to be true, otherwise the code does not get executed.
- Structure of if statement: If statement has the following structure in C language: if (condition) , Associated Code
- Here is a brief description of different components involved in the general structure of if statement.
- 1- In the given structure, if is a keyword that is followed by a condition inside parentheses (). 2- A condition could be any valid expression including arithmetic expressions, relational expressions, logical expressions, or a combination of these. Here are a few examples of valid expressions that can be used as condition.
- Any expression that has a non-zero value calculates to true, e.g. expressions a and b above produce a true value, but the expression c produces a false value. The expression can also include variables, in that case values inside the variables are used to calculate the true/false value of the expression.
- The flow of program execution is controlled through control statements.
- Sequential control is the default control structure in C language. According to the sequential control, all the statements are executed in the given sequence.
- The statements which help us to decide which statements should be executed next, on the basis of conditions, are called selection statements.