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");
else
printf("Hiii");
}

  1. Okkk

  2. Hiii

  3. Error

  4. None

Answer
Correct Answer - 1
Okkk
1)以下程序的輸出是什么?
  1. Okkk

  2. iii

  3. 錯誤

  4. 沒有

回答
正確答案-1
Okkk
2) What will be the output of following program ?
#include <stdio.h>
void main()
{
int x=22;
if(x=10)
printf("TRUE");
else
printf("FALSE");
}

  1. TRUE

  2. FALSE

  3. Error

  4. None

Answer
Correct Answer - 1
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)以下程序的輸出是什么?
  1. 真正

  2. 錯誤

  3. 沒有

回答
正確答案-1
真正
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");
else
printf("FALSE");
}

  1. FALSE

  2. Error

  3. TRUE

  4. None

Answer
Correct Answer - 1
FALSE
3)以下程序的輸出是什么?
  1. 錯誤

  2. 真正

  3. 沒有

回答
正確答案-1
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 !!!");
else
printf("Not matched !!!");
printf("\n===SECOND CONDITION\n");
if(sizeof(a)==sizeof(10.5f))
printf("Matched !!!");
else
printf("Not matched !!!");
printf("\n===THIRD CONDITION\n");
if(sizeof((double)a)==sizeof(10.5))
printf("Matched !!!");
else
printf("Not matched !!!");
printf("\n===FOURTH CONDITION\n");
if(a==10.5f)
printf("Matched !!!");
else
printf("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;
}
  1. Hello...

  2. Hello...OK

  3. OK

  4. Error

Answer
Correct Answer - 4
Error : misplaced break/ illegal break
A break statement can be used with looping and switch statements.
5)以下程序的輸出是什么?
  1. 你好...

  2. 你好...好

  3. 錯誤

回答
正確答案-4
錯誤:錯誤放置的中斷/非法中斷
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.");
else
printf("%s","Condition is false.");
return 0;
}
  1. Condition is true.

  2. Condition is false.

  3. No output

  4. ERROR

Answer
Correct Answer - 1
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)以下程序的輸出是什么?
  1. 條件為真。

  2. 條件為假。

  3. 無輸出

  4. 錯誤

回答
正確答案-1
條件為真。
對于任何條件,任何非零值均視為true。
考慮以下表達式:if((-100 && 100)||((20 && -20))
= if((1)||(1))
=如果(1)
7) What will be the output of following program ?
#include <stdio.h>
#define TRUE 1
int main()
{
if(TRUE)
printf("1");
printf("2");
else
printf("3");
printf("4");
return 0;
}
  1. ERROR

  2. 1

  3. 12

  4. 2

Answer
Correct Answer - 1
ERROR : misplaced if/illegal else without matching if.
You can use only one statement within the if( )without parenthesis {...} .
7)以下程序的輸出是什么?
  1. 錯誤

  2. 1個

  3. 12

  4. 2

回答
正確答案-1
錯誤:如果/錯誤放置,否則不匹配。
沒有括號{...}的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");
else
printf("Hiiiii");
return 0;
}
  1. No output

  2. Hiiiii

  3. Heyyyyy

  4. HeyyyyyHiiiii

Answer
Correct Answer - 2
Hiiiii
printf("Hiiiii"); that is written after else , is treated as else part of inner if condition if(pn<20).
8)以下程序的輸出是什么?
  1. 無輸出

  2. i

  3. 嘿嘿

  4. HeyyyyyHiiiii

回答
正確答案-2
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");

  1. 3 and 4.

  2. 3 only.

  3. 4 only.

  4. 2,3 and 4.

Answer
Correct Answer - 3
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。
  1. 3和4。

  2. 僅3個。

  3. 僅4個。

  4. 2,3和4。

回答
正確答案-3
僅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");
else
printf("0");
return 0;
}
  1. 10.

  2. 10L.

  3. 10L10.

  4. ERROR.

Answer
Correct Answer - 2
10L.
10)以下程序的輸出是什么?
  1. 10。

  2. 10升

  3. 10L10。

  4. 錯誤。

回答
正確答案-2
10升

翻譯自: https://www.includehelp.com/c-programs/c-if-else-aptitude-questions-and-answers.aspx

c# 情感傾向

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/541752.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/541752.shtml
英文地址,請注明出處:http://en.pswp.cn/news/541752.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

springboot中使用緩存shiro-ehcache

在pom.xml中注入緩存依賴&#xff0c;版本(Sep 09, 2016)spring-context-support 包含支持UI模版&#xff08;Velocity&#xff0c;FreeMarker&#xff0c;JasperReports&#xff09;&#xff0c; 郵件服務&#xff0c; 腳本服務(JRuby)&#xff0c; 緩存Cache&#xff08;EHCa…

oracle 微信公眾號,關于微信公眾號貼代碼的方法

微信公眾號碼上貼代碼一直一來都是個頭疼的問題。吐槽一句&#xff1a;要是后臺編輯器支持markdown就好了。今天教大家用在線markdown排版工具&#xff0c;把代碼完美貼到微信公眾號上。長話短說&#xff0c;今天用到的兩個工具&#xff1a;首先&#xff0c;以一段代碼為例。假…

計算理論 形式語言與自動機_下推式自動機(PDA)| 計算理論

計算理論 形式語言與自動機Pushdown Automaton (PDA) is a kind of Automaton which comes under the theory of Computation that appoints stack. The word Pushdown stands due to the fact that the stack can be pushed down as operations can only work on the elements…

運維人員究竟如何提升價值,持續獲得高薪?

作者簡介&#xff1a;老男孩&#xff0c;北京老男孩IT教育創始人&#xff0c;17年IT經驗&#xff0c;資深Linux實戰專家&#xff0c;IT培訓界實戰派頂尖大師&#xff0c;國內將實戰心理學體系大量注入IT運維培訓領域的第一人&#xff0c;多本IT暢銷圖書作者&#xff0c;51CTO金…

Webservice soap wsdl區別之個人見解

Web Service實現業務訴求&#xff1a;Web Service是真正“辦事”的那個&#xff0c;提供一種辦事接口的統稱。WSDL提供“能辦的事的文檔說明”&#xff1a;對要提供的服務的一種描述格式。我想幫你的忙&#xff0c;但是我要告訴你我都能干什么&#xff0c;以及干這些事情需要的…

java uuid靜態方法_Java UUID nameUUIDFromBytes()方法及示例

java uuid靜態方法UUID類名UUIDFromBytes()方法 (UUID Class nameUUIDFromBytes() method) nameUUIDFromBytes() method is available in java.util package. java.util包中提供了nameUUIDFromBytes()方法 。 nameUUIDFromBytes() method is used to get a UUID constructed fr…

清空 linux 服務器,Linux服務器清理

Why?廢話不多說直接來圖&#xff0c;可以看出磁盤已經快要滿了未清之前What?可以看出mnt文件夾占用的最大&#xff0c;然后進入mnt目錄里通過命令,根據文件大小對該路徑下文件排序du -h --max-depth1我們服務器出現磁盤快滿了的原因是因為&#xff0c;服務器部署了多個tomcat…

Git中的AutoCRLF與SafeCRLF換行符問題

2019獨角獸企業重金招聘Python工程師標準>>> 原文&#xff1a;http://www.cnblogs.com/flying_bat/archive/2013/09/16/3324769.html 最近在使用GitHub&#xff0c;發現不時沒有修改過的文件要提交&#xff0c;對比發現文件全部修改&#xff0c;但找不到不一樣的地方…

stringwriter_Java StringWriter getBuffer()方法與示例

stringwriterStringWriter類的getBuffer()方法 (StringWriter Class getBuffer() method) getBuffer() method is available in java.io package. getBuffer()方法在java.io包中可用。 getBuffer() method is used to get the StringBuffer that holds the present buffer valu…

linux 下郵件服務器,Linux 下搭建Postfix郵件服務器

Linux 下搭建Postfix郵件服務器詳解&#xff1a;1、首先關閉sendmail服務service sendmail stop2、chkconfig sendmail off(關閉開機自啟動)3、修改DNS正解文件&#xff0c;使DNS能夠解析郵箱服務添加下面兩行mail.zhubf.com. IN A 172.17.17.2zhubf.com. IN M…

Java PipedInputStream close()方法與示例

PipedInputStream類close()方法 (PipedInputStream Class close() method) close() method is available in java.io package. close()方法在java.io包中可用。 close() method is used to close this PipedInputStream and free all system resources linked with this stream…

Coreseek Windows下安裝調試

由于項目需要全文檢索&#xff0c;后面就去網上查了下資料&#xff0c;找到了Sphinx【中文是獅身人面像】這個全文檢索引擎&#xff0c;聽說挺好用的&#xff0c;不過沒有中文分詞。后面又去找了一下&#xff0c;找到了Coreseek&#xff0c;一款中文全文檢索/搜索軟件。 一、Sp…

linux sudo命令全稱,linux sudo命令的概念與使用

1.sudo介紹本文引用地址&#xff1a;http://www.eepw.com.cn/article/201610/305498.htmsudo是linux下常用的允許普通用戶使用超級用戶權限的工具&#xff0c;允許系統管理員讓普通用戶執行一些或者全部的root命令&#xff0c;如halt&#xff0c;reboot&#xff0c;su等等。這樣…

java 方法 示例_Java語言環境getISOCountries()方法與示例

java 方法 示例區域設置類getISOCountries()方法 (Locale Class getISOCountries() method) getISOCountries() method is available in java.util package. getISOCountries()方法在java.util包中可用。 getISOCountries() method is used to return an array of string that …

android shape.xml 屬性詳解

轉載源:http://blog.csdn.net/harvic880925/article/details/41850723 一、簡單使用 剛開始&#xff0c;就先不講一堆標簽的意義及用法&#xff0c;先簡單看看shape標簽怎么用。 1、新建shape文件 首先在res/drawable文件夾下&#xff0c;新建一個文件&#xff0c;命名為&#…

linux檢查防火墻是否阻擋端口,淺析linux查看防火墻狀態和對外開放的端口狀態...

1.查看防火墻狀態查看防火墻狀態 systemctl status firewalld開啟防火墻 systemctl start firewalld關閉防火墻 systemctl stop firewalld開啟防火墻 service firewalld start若遇到無法開啟先用&#xff1a;systemctl unmask firewalld.service然后&#xff1a;systemctl star…

Java類class getClasses()方法及示例

類的類getClasses()方法 (Class class getClasses() method) getClasses() method is available in java.lang package. getClasses()方法在java.lang包中可用。 getClasses() method is used to return an array that contains Class objects denoting all the public classes…

linux內核計數函數,linux中的內核引用計數器

linux中的內核引用計數器文檔 /Documentation/kref.txt翻譯。krefs能讓你往你的對象中添加一個引用計數器。如果你有一些需要在多處被使用和傳遞的對象&#xff0c;而你并沒有給這些對象中添加引用計數器的話&#xff0c;你的代碼肯定會有某些缺陷&#xff0c;會出現一些問題。…

jQuery常用的全局方法源碼

下面常用方法的詳細使用請查看&#xff1a;http://www.cnblogs.com/moqiutao/p/4775725.html 1.$.noConflict()方法 語法&#xff1a;jQuery.noConflict(removeAll) removeAll&#xff1a;布爾值。指示是否允許徹底將 jQuery 變量還原。 源碼&#xff1a; var// Map over jQuer…

isinstance_Java類class isInstance()方法及示例

isinstance類class isInstance()方法 (Class class isInstance() method) isInstance() method is available in java.lang package. isInstance()方法在java.lang包中可用。 isInstance() method is used to check whether the given object is an instance with the object d…