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.mzph.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…