题目详情

逻辑表达式求值时常采用短路计算方式。“&&”“||”“!”分别表示逻辑与、或、非运算,“&&”“||”为左结合,“!”为右结合,优先级从高到低为“!”“&&”“||”。对逻辑表达式“x&&(y||!z)”进行短路计算方式求值时,()。

  • A.x为真,则整个表达式的值即为真,不需要计算y和z的值
  • B.x为假,则整个表达式的值即为假,不需要计算y和z的值
  • C.x为真,再根据2的值决定是否需要计算y的值
  • D.x为假,再根据y的值决定是否需要计算z的值

正确答案及解析

正确答案
B
解析

由“逻辑与”“逻辑或”运算构造的逻辑表达式可采用短路计算的方式求值。“逻辑与”运算“&&”的短路运算逻辑为:a&&b为真当且仅当a和b都为真,当a为假,无论b的值为真还是假,该表达式的值即为假,也就是说此时不需要再计算b的值。“逻辑或”运算“||”的短路运算逻辑为:a||b为假当且仅当a和b都为假,当a为真,无论b的值为真还是假,该表达式的值即为真,也就是说此时不需要再计算b的值。对逻辑表达式“x&&(y||!z)”进行短路计算方式求值时,x为假则整个表达式的值即为假,不需要计算y和z的值。若x的值为真,则再根据y的值决定是否需要计算z的值,y为真就不需要计算z的值,y为假则需要计算z的值。

包含此试题的试卷

你可能感兴趣的试题

单选题

Advancements in ( )have contributed to the growth of the automotive industry through the creation and evolution of self-driving vehicles.

  • A.Artificial Intelligence
  • B.Cloud Computing
  • C.Internet of Things
  • D.Big Data
查看答案
单选题

In project human resource management , ( )is not a source of power for the project manager.

  • A.referent power
  • B.expert power
  • C.reward power
  • D.audit power
查看答案
单选题

At the project establishment stage , the feasibility study mainly includes techinical feasibility analysis , ( ), operation environment feasibility analysis and other aspects of feasibility analysis.

  • A.detail feasibility analysis
  • B.opportunity analysis
  • C.economic feasibility analysis
  • D.risk analysis
查看答案
单选题

( )is a grid that shows the project resources assigned to each work package.

  • A.Stakeholder engagement assessment matrix
  • B.Requirements traceability matrix
  • C.Probability and impact matrix
  • D.Responsibility assignment matrix
查看答案
单选题

Xinhua News Agency reported in January 2022,Chian will further promote the developmet of a digital economy during the 14th Five-Year Plan eriod(2021-2025). The plan also emphasized industrial ( )transformation.

  • A.digital
  • B.networking
  • C.intelligentize
  • D.informatization
查看答案

相关题库更多 +