Answer the following questions:-
1. What are the different types of operators? Explain with examples.
2. Write a note on expressions.
3. Distinguish between LET and INPUT commands.
4. What is looping ? Describe the types of looping with example.
5. What is the difference between IF... THEN & IF... THEN... ELSE statements ? Explain.
6. What are the difference between a Ture loop & False loop?
Answers
Answer:
1. Operators are special type of functions, that takes one or more arguments and produces a new value. For example : addition (+), substraction (-), multiplication (*) etc, are all operators. Operators are used to perform various operations on variables and constants.
2. Expression: An expression is a combination of operators, constants and variables. An expression may consist of one or more operands, and zero or more operators to produce a value.
3. LET : 1. Programmer assigns the value while writing the program. INPUT : 2. Different values could be entered in different times of execution.
4. In computer science, a loop is a programming structure that repeats a sequence of instructions until a specific condition is met. Programmers use loops to cycle through values, add sums of numbers, repeat functions, and many other things. ... Two of the most common types of loops are the while loop and the for loop.
5. With the if statement, a program will execute the true code block or do nothing. With the if/else statement, the program will execute either the true code block or the false code block so something is always executed with an if/else statement.
6. If it is true, the code executes the body of the loop again. This process is repeated as long as the expression evaluates to true. If the expression is false, the loop terminates and control transfers to the statement following the do-while loop.