Professional Documents
Culture Documents
Programming Language Concern These Are of Two Types
Programming Language Concern These Are of Two Types
**1)if (condition)
**2)
if (condition)
else
For example=>
switch (expression) {
case value1:
// Code to be executed if expression == value1
break;
case value2:
// Code to be executed if expression == value2
break;
...
default:
// Code to be executed if none of the cases match
break;
}
Syntax=>
for (initialization; condition; update) {
// code to be executed
}
while loop=>
A while loop in C is a control flow structure that allows for a piece of code to be
executed repeatedly as long as a particular condition is true.
Syntax:
while (condition) {
// code to be executed
}
do-while loop=>
The do-while loop checks the condition after executing the loop body,
which ensures that the loop body is executed at least once, even if the
condition is initially false.
So even if a condition is false in the first place, the do-while loop would have
already run once. A do-while loop is very much similar to a while loop, except for
the fact that it is guaranteed to execute the body at least once.
Syntax:
do {
// code block
} while (condition);
Jump statement:
Jump Statement in C is used in C programming language to
transfer control from one part of the program to another.
There are four types of Jump Statements in C: break,
continue,return and goto. While these statements can be useful in
certain situations, they can also lead to errors if not used properly.
Nested loop=>
A nested loop is a loop inside another loop. The most common nested loop is a
for loop.
For example =>
// outer loop
// codes
// inner loop
// codes
Ladder conditions=>
if else if ladder in C programming is used to test a series of conditions sequentially.
if (number > 0) {
printf("The number is positive.\n");
}
getch();
}
Error in c
Errors in C language are defined as an illegal operations performed
by the user, resulting in the abnormal or abrupt working of the
program logic.
An error in C programming is an issue that causes the program to not work as
intended, or to crash. Errors can be caused by mistakes in the code, incorrect input,
or hardware problems.
There are five different types of errors in C Programming
like Syntax Error, Run Time Error, Logical Error, Semantic Error,
and Linker Error.
*Syntax errors:
These errors occur when the code does not follow the rules of the C language. For example, a missing
semicolon or an incorrect spelling.
*Run-time errors:
These errors occur when the program is running. For example, trying to divide by zero or accessing an
element that is out of bounds can cause a run-time error.
*Logical errors:
These errors occur when the code does not produce the desired output. For example, a loop that never
ends
*Linker errors:
These errors occur when the linker cannot find the libraries that the program needs. For example, if the
program tries to use a function that is not in a linked library, a linker error will occur.
*Binary operators:
-----------Question paper
Q1. what is control statement ? [5]
Q2. Explain variable, Identifiers and keywords with
example. [5]
Q3. difference between selection and looping
statements. [5]
Q4. difference between while loop and do while loop.
[5]
Q5. describe the structure of C program. [5]
Q6. what is unary and binary operators ? explain[5]
Q7. what is error ? Explain types of error[5]
Q8. what is Nested loop and Ladder conditions ? Give
Example. [5]
Q9. Difference between switch case and if, else if,
else. [5]
Q10. Who was the founder of C lang. ? [5]