题目详情

阅读下面的C语言程序,请给出正确的输出结果( )。#include#define N 10#define s(x)x*x#define f(x)(x*x)#define g(x)((x)*(x))main( ){int i1,i2,i3,i4;i1=1000/s(N);i2=1000/f(N);i3=f(N+1);i4=g(N+1);printf(“i1=%d,i2=%d,i3=%d,i4=%d\n”,i1,i2,i3,i4);}

  • A.i1=1000,i2=10,i3=21,i4=121
  • B.i1=10,i2=10,i3=121,i4=121
  • C.i1=1000,i2=1000,i3=21,i4=21
  • D.i1=10,i2二1000,i3=121,i4=21

正确答案及解析

正确答案
A
解析

本题考查宏概念,以及宏替换相关的基础知识。表达式1000/s(N)宏替换后为:1000/10*10,因此结果为1000,而不是期待的10。表达式1000/f(N)宏替换后为:1000/(10*10),因此结果为10,是期待的结果。表达式f(N+1)宏替换后为:(10+1*10+1),因此结果为21,而不是期待的121。表达式g(N+1)宏替换后为:((10+1)*(10+1)),结果为121,是期待的结果。因此,题中程序运行结果为“i1=1000,i2=10,i3=21,i4=121”。

你可能感兴趣的试题

单选题

( )is that it provides guidance and direction on how quality will be managed and verified throughout the project.

  • A.Plan Quality Management
  • B.Manage Quality
  • C.Control Quality
  • D.Project Charter
查看答案
单选题

( )the process of determining,documenting,and managing stakeholder needs and requirements to meet Project objectives.

  • A.Plan Scope Management
  • B.Collection Requirements
  • C.Validate Scope
  • D.Control Scope
查看答案
单选题

The information security management system preserves the confidentiality,integrity and availability of information by applying a( ).

  • A.technology management process
  • B.resource management process
  • C.quality management process
  • D.risk management process
查看答案
单选题

( )is a decentralized database,ensure that the data will not be tampered with and forged.

  • A.Artificial intelligence
  • B.Blockchain
  • C.Sensing technology
  • D.Big datA
查看答案
单选题

( )puts computer resources on the web,and must meet the requirements of super capacity,super concurrency,super speed and super security.

  • A.Cloud computing
  • B.Big datA
  • C.Blockchain
  • D.Internet of things
查看答案

相关题库更多 +