21 The defaur case is required in the swaon 22 The break statement re eeleesen s
ID: 3793585 • Letter: 2
Question
21 The defaur case is required in the swaon 22 The break statement re eeleesen statement 23, required the defauneaseofa eseenen The expression (x a by is true ther y is true or a 24, An expression containing the ll operator is true ir eiher or been er euerands 25. If there are fewer initializers in an initialzer set than the number or in array, C elements the automatically initializes the remaining elements to the last value in the list of initialueers 26. An individual array element thats passed to a function as an argument of the form aA ana modned in the called function will contain the modified value in the caling 27. A sentinel value must be a value that cannot be confused with a legnmate data value T 28. Conditions written inside decision symbols always contain arithmetic operators e... .I. and 29. In top-down, stepwise refinement, each refinement is a complete representation ot the algorithm TExplanation / Answer
question 22.->
ans. Break statement is used to get out of the "{}" that can be any case
1) if-else statement
2)for loop
3)while loop
example->
#include<stdio.h>
int main()
{
int i,n;
printf("enter the value of n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
i=i+n;
printf("%d",i); -> this code will print the value of i only once you can check the code by running it
break; any software.
}
}
yes break is required in default as it is the last choice after which the switch case ends,break gets the code to come out from the "{}" ( TRUE).
question 23.
Answer->
the statement (x>y && a<b) is only true if both the condition satisfies
that is -> x must be greater than y and a must be less than b
then only it will enter the if {}->braces
&& means the AND gate that is output is true if both are true (1.1=1)
example
#include<stdio.h>
int main()
{
int x=5,y=3,a=7,b=10;
if(x>y && a<b)
{
printf(" both are true);
}
a=9;
b=3;
if(x>y && a<b)
{
printf(" both are true");
}
else
{
printf(" both must be true");
}
}
(TRUE).
question 24.
Answer-> (| |) OR operator works as the same as the OR gate,that is either of one is true(1) output will be true,
same goes with if statement,if n condition are writen in the if block and even 1 of them is true then statement will execute,but if there is no such condition that id true then the if block will not execute.
(1.0=1,
1.1=1,
0.1=1,
0.0=0)
example->
#include<stdio.h>
int main()
{
int x=5,y=7,a=9,b=4;
if(x>y || a>b)
{
printf(" one of them is true");
}
if(x>y || a<b)
{
printf(" none of them is true");
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.