What Are Control Structures?: Semicolon at The End of For Loop
What Are Control Structures?: Semicolon at The End of For Loop
Ans: These are the programming statements, which controls the sequence of
program execution.Some statements are executed based on conditions.Some
statements gets executed repeated number of times.
2. If a semicolon is put at the end of [for, if, else, while etc]. Explain the results?
Ans:
Semicolon at the end of for loop
for(I=1;I<=10;I++);
printf(%d\n, I);
output : 11
Semicolon at the end of while loop
I = 1;
while( I <= 10 );
{
printf(%d, I);
}
output : Program runs for infinite times without printing anything
Semicolon at the end of if condition
Case I:
if (n > 10);
printf(Hai\n);
else
printf(Bye);
Error : hanging else
Case II:
if( n > 10 );
printf(Hai\n);
printf(Bye);
Output:
If n is > 10 then
Hai
If n <= 10 then output would be:
Hai
Bye
Semicolon at the end of else
if(n > 10 )
printf(Hai);
else;
printf(Bye);
Output: Bye would be printed always, The printed of Hai depends on the condition
4. When to use what loop?
Ans:
For loop:
If we have all the three sections directly (initialization; testing; modification)
Ex1 : for( I = 1; I<=n;I++)
Also these sections should be small statements
TWO MARKS:
UNIT 1
1. What is a computer?
2. What are programming developing steps?
3. Define an algorithm?
4. Define flow chart?
5. What are the advantages and disadvantages of an algorithm?
6. What are the advantages and disadvantages of a flowchart?
7. What are the operators used in c language?
8. What are C tokens?
9. Write down the rules for variables?
10. What is type casting and type conversion?
11. What are keywords?
12. Define identifiers?
13. What is a constant?
14. What is a compiler?
15. What is a linker?
16. Draw the different symbols used in flow chart?
17. What are the characteristics of algorithm?
18. Write the features of C?
19. Write the character set in C language?