c# 情感倾向_C否则-能力倾向问题与解答
c# 情感傾向
C programming if else Aptitude Questions and Answers: In this section you will find C Aptitude Questions and Answers on condition statements – if else, nested if else, ladder if else, conditional operators etc.
C語言編程如果有問題,請執行以下步驟:在本節中,您將找到條件語句的C語言問題和答案-如果有,則嵌套,如果有則階梯,有條件的運算符等。
1) What will be the output of following program ? #include <stdio.h> void main() {if(!printf(""))printf("Okkk");elseprintf("Hiii"); }Okkk
Hiii
Error
None
Okkk 1)以下程序的輸出是什么?
Okkk
iii
錯誤
沒有
Okkk 2) What will be the output of following program ? #include <stdio.h> void main() {int x=22;if(x=10)printf("TRUE");elseprintf("FALSE"); }
TRUE
FALSE
Error
None
TRUE
if(x=10)... "=" is an assignment operator, so 10 will be assigned to x and condition will be true due to if(10).. 2)以下程序的輸出是什么?
真正
假
錯誤
沒有
真正
if(x = 10)...“ =”是一個賦值運算符,因此由于if(10) ,x將賦給10,并且條件為true。 3) What will be the output of following program ? #include <stdio.h> void main() {char val=1;if(val--==0)printf("TRUE");elseprintf("FALSE"); }
FALSE
Error
TRUE
None
FALSE 3)以下程序的輸出是什么?
假
錯誤
真正
沒有
假 .minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}} .minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}} 4) What will be the output of following program ? #include <stdio.h> void main() {float a=10.5;printf("\n===FIRST CONDITION\n");if(sizeof(a)==sizeof(10.5))printf("Matched !!!");elseprintf("Not matched !!!");printf("\n===SECOND CONDITION\n");if(sizeof(a)==sizeof(10.5f))printf("Matched !!!");elseprintf("Not matched !!!");printf("\n===THIRD CONDITION\n");if(sizeof((double)a)==sizeof(10.5))printf("Matched !!!");elseprintf("Not matched !!!");printf("\n===FOURTH CONDITION\n");if(a==10.5f)printf("Matched !!!");elseprintf("Not matched !!!");printf("\n"); } Answer ===FIRST CONDITION
Not matched !!!
===SECOND CONDITION
Matched !!!
===THIRD CONDITION
Matched !!!
===FOURTH CONDITION
Matched !!!
in this program a is a float variable and value 10.5 will consider as double. 4)以下程序的輸出是什么? 回答 ===第一條件
不匹配!
===第二條件
匹配!
===第三條件
匹配!
===第四條件
匹配!
在此程序中,a是一個浮點變量,值10.5將被視為double。 5) What will be the output of following program ? #include <stdio.h> int main() {int a=10;if(a==10){printf("Hello...");break;printf("Ok");}else{printf("Hii");}return 0; }
Hello...
Hello...OK
OK
Error
Error : misplaced break/ illegal break
A break statement can be used with looping and switch statements. 5)以下程序的輸出是什么?
你好...
你好...好
好
錯誤
錯誤:錯誤放置的中斷/非法中斷
break語句可與循環和switch語句一起使用。 6) What will be the output of following program ? #include <stdio.h> int main() {if( (-100 && 100)||(20 && -20) )printf("%s","Condition is true.");elseprintf("%s","Condition is false.");return 0; }
Condition is true.
Condition is false.
No output
ERROR
Condition is true.
Any non zero value is treated as true for conidion.
Consider the expressions: if( (-100 && 100)||(20 && -20) )
=if( (1) || (1) )
=if(1)
6)以下程序的輸出是什么?
條件為真。
條件為假。
無輸出
錯誤
條件為真。
對于任何條件,任何非零值均視為true。
考慮以下表達式:if((-100 && 100)||((20 && -20))
= if((1)||(1))
=如果(1)
.minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}} .minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}} 7) What will be the output of following program ? #include <stdio.h> #define TRUE 1 int main() {if(TRUE)printf("1");printf("2");elseprintf("3");printf("4");return 0; }
ERROR
1
12
2
ERROR : misplaced if/illegal else without matching if.
You can use only one statement within the if( )without parenthesis {...} .
7)以下程序的輸出是什么?
錯誤
1個
12
2
錯誤:如果/錯誤放置,否則不匹配。
沒有括號{...}的if()中只能使用一個語句。
8) What will be the output of following program ? #include <stdio.h> int main() {int pn=100;if(pn>20)if(pn<20)printf("Heyyyyy");elseprintf("Hiiiii");return 0; }
No output
Hiiiii
Heyyyyy
HeyyyyyHiiiii
Hiiiii
printf("Hiiiii"); that is written after else , is treated as else part of inner if condition if(pn<20). 8)以下程序的輸出是什么?
無輸出
i
嘿嘿
HeyyyyyHiiiii
i
printf(“ Hiiiii”); 在else后面寫入的內容被視為if條件if(pn <20)的內部else部分。 9) Which of the following are incorrect statements? If int a=10. 1) if( a==10 ) printf("IncludeHelp"); 2) if( 10==a ) printf("IncludeHelp"); 3) if( a=10 ) printf("IncludeHelp"); 4) if( 10=a ) printf("IncludeHelp");
3 and 4.
3 only.
4 only.
2,3 and 4.
4 only.
Consider the following expressions:
if(a==10) => if(1) => correct.
if(10==a) => if(1) => correct.
if(a=10) => if(10) => correct (10 is a non zero value).
if(10=a) => incorrect, because value of a can not assign in 10, Lvalue required error is occurred. 9)以下哪項是不正確的陳述? 如果int a = 10。
3和4。
僅3個。
僅4個。
2,3和4。
僅4個。
請考慮以下表達式:
if(a == 10) => if(1)=>正確。
if(10 == a) => if(1)=>正確。
if(a = 10) => if(10)=>正確(10是一個非零值)。
if(10 = a) =>錯誤,因為不能在10中分配a的值,所以發生了Lvalue必需的錯誤。 10) What will be the output of following program ? #include <stdio.h> int main() {int a=10;if(10L == a)printf("10L");else if(10==a)printf("10");elseprintf("0");return 0; }
10.
10L.
10L10.
ERROR.
10L.
10)以下程序的輸出是什么?
10。
10升
10L10。
錯誤。
10升
翻譯自: https://www.includehelp.com/c-programs/c-if-else-aptitude-questions-and-answers.aspx
c# 情感傾向
總結
以上是生活随笔為你收集整理的c# 情感倾向_C否则-能力倾向问题与解答的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java LocalDate类| toS
- 下一篇: c# uri.host_C#| Uri.