28、以下代码的执行结果是()。 def area(r, pi = 3.14159): return pi * r *r area(pi = 3.14, r = 4)A.报错B.无输出C.39.4384D.50.24

28、以下代码的执行结果是()。 def area(r, pi = 3.14159): return pi * r *r area(pi = 3.14, r = 4)

A.报错

B.无输出

C.39.4384

D.50.24


参考答案和解析
B

相关考题:

定义一个常量PI,可以使用下列语句中的( )。 A..PI= 3.14159B.Set PI = 3.14159C.Const PI = 3.14159D.Const PI

以下程序的执行结果是【】。 include define PI____3.14159 const int R=10; void main() 以下程序的执行结果是【 】。include<iostream>define PI____3.14159const int R=10;void main(){double a,b;ac2*R*PI;b=R*R*PI;cout<<"a="<<a<<","<<"b="<<b<<endl;"}

以下程序的功能是:给r输入数据后计算半径为r的圆面积s。程序在编译时出错。main()/* Beginning */{ int r; float s; scanf("%d",r); s=*PI*r*r; printf("s=%f\n",s);}若想纠正错误,应该( )。 A)更改注释语句书写位置 B)存放圆半径的变量r应该定义为整型C)输出语句中不能加“s=” D)给计算面积的PI变量赋值

( 13 )补充完整下面的类定义:const double PI=3 .14;class Circle{ // 圆形物体的抽象基类protected:double r; // 半径public:Circle ( double radius=0 ) : r ( radius ) {}【 13 】 ; // 计算圆形物体表面积的纯虚函数声明};class Cylinder:public Circle { // 圆柱体类double h; // 高度public:Cylindr ( double radius=0, doubli height=0 ) :Circle ( radius ) , h ( height ) {}Virtual double Area () { // 计算圆柱体的表面积return 2*PI*r* ( r+h ) ;}};

阅读以下说明和C++代码,填入(n)处。[说明]以下C++代码使用虚函数实现了同一基类shape派生出来的Class rectangle、Class triangle、Class circle实现了计算矩形、圆形面积的计算。仔细阅读以下代码,将(n)处语句补充完整。[代码5-1]include<iostream.h>define PI 3.14159class shape {//基类protected:(1);public:(2);(3);};[代码5-2]class rectangle: public shape {public:rectangle (int x2,int y2,int r2): (4) {};double area ( ) {return x*y; };};class circle: public shape {public:circle (int x3,int y3,int r3):(5){};double area ( ) {return r*r*PI; };};[代码5-3]void main ( ){rectangle r (10,20,0);circle c (0,0,30);shape (6);cout<<"长方形面积="<<s1->area ( ) <<endl;cout<<"圆形面积="<<s2->area ( ) <<endl;}[运行结果]长方形面积=200圆形面积=2827.43

使用VC6打开考生文什夹下的工程test1_3。此工程包含一个test1_3.cpp,其中定义了类circle和column,其中column类由circle类protected派生,但两个类的定义并不完整。请按要求完成下列操作,将程序补充完整。(1)定义类circle的保护数据成员r和area,它们都是double型的数据。请在注释“//**1**”之后添加适当的语句。(2)添加类circle的无参数的构造函数,使circle对象的r默认值为0,请在汁释“//**2**”之后添加适当的语句。(3)添加派生类column构造函数的定义,传入的参数为double型的height和radius,并将具分别赋值给数擗成员h和基类的r,请在注释“//**3**”之后添加适当的语句。(4)完成派生类column的成员函数print的定义,使其以格式“r=_area=_”先输出半径r和底面积area,再以格式“h=_vol=_”输出高h和体积vol的值,请在注释“//**4**”之后添加适当的语句。输山结果如下:r=1 area=3.1416h=2 vo1=6.2832注意:除在指定的位置添加语句外,请不要改动程序中的其他语句。源程序文件test1_3.cpp清单如下:include<iostream.h>const double pi=3.1416;class circle{protected://**1**public://**2**circle(double radius){ r=radius;}void print(){area=r*r*pi;cout<<"r="<<r<<" "<<"area="<<ared<<endl;}};class column: protected circle{protected:double h;public://** 3 **void print(){// ** 4 **}};void main(){column col(1.0,2.0);Col.print();}

设R(Pi)表示进程Pi执行时必须读变量的语句集合,W(Pi)表示Pi执行时必须写变量的语句集合。现在有P1和P2两个进程,若要这两个进程并发,必须满足()A. R(P1)与W(P2)的交集为空B. W(P1)与W(P2)的交集为空C. R(P1)与R(P2)的交集为空D. W(P1)与R(P2)的交集为空

下列程序的执行结果是______。 include float temp; floatfn2(float r) { temp= 下列程序的执行结果是______。include<iostream.h>float temp;floatfn2(float r){temp=r*r*3.14;return temp;}void main( ){float a=fn2(5.0);floatb=fn2(5.0);b=20;cout<<temp<<endl;}

有以下程序:includeusingnamespacestd;definePI3.14classPoint{private: intx,y;pub 有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; } int gety() { return y; } }; class Circle : public Point { private: int r; public: Circle(int a,int b,int c):Point(a,b) { r=c; } int getr() { return r; } double area() { return PI*r*r; } }; int main() { Circle c1(5,7,10); cout<<cl.area()<<endl; return 0; } 程序执行后的输出结果是A.314B.157C.78.5D.153.86

下面程序的输出结果是( )。 #define PI 3.1415 #define ARE(X) PI*x*x main() { int r=2; printf("%.2f",ARE(r+1)); }A.28.26B.28.26C.9.28D.9.28

阅读以下说明和JAVA 2代码,填入(n)处的。[说明]以下JAVA程序实现了在接口interface iShape2D的定义和应用,仔细阅读代码和相关注释,将程序补充完整。[代码6-1]interface iShape2D //定义接口{(1)(2)}(3)//实现CRectangle类{int width, height;(4) CRectangle (int w,int h) {width=w;height=h;}public void area ( ){ //定义area( )的处理方式System. out.println ("area="+width*height);}}(5)//实现CCircle类{double radius;(6) CCircle (double r) {radius=r;}public void area ( ) { //定义area( )的处理方式System.out.println ("area="+pi*radius*radius);}}[代码6-2]public class app10_4{public static void main(String args[]){CRectangle rect=new CRectangle (5,10);rect.area ( ); //调用CRectangle类里的area ( ) methodCCircle cir=new CCircle (2.0);cir.area ( ); //调用CCircl类里的area ( ) method}}

下面程序的输出结果是( ) #define PI 3.1415 #define ARE(x) PI*x*x main () {int r=2; printf("%f",ARE(r+1)); }A.28.26B.28.26C.9.28D.9.28

程序运行结果为______。#define R 3.0#define PI 3.1415926#define L 2*PI*R#define S PI*R*Rmain(){ printf("L=%f S=%f\n",L,S);}A.L=18.849556 S=28.274333B.18.849556=18.849556 28.274333=28.274333C.L=18.849556 28.274333=28.274333D.18.849556=18.849556 S=28.274333

若有以下程序:include using namespace std;define PI 3.14class Point{private: in 若有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; } int gety() { return y; } }; class Circle : public Point { private: int r; public: Circle(int a, int b,int c) :Point(a,b) { r=c; } int getr() { return r; } double area() { return PI*r*r; } }; int main() { Circle c1(5,7,10); cout<<c1.area()<<end1; return 0; } 程序执行后的输出结果是( )。A.314B.157C.78.5D.153.86

请把下面程序补充完整,正确答案是( )。 main( ) { float radius,length,area,volume; printf("Input a radius:"); Scanf("%f",radius); length=2.0*PI*radius; /*引用无参宏求周长*/area=PI*radius*redius; /*引用无参宏求而积*/ volume=PI*radius*radius*radius*3/4; /*引用无参宏求体积*/ printf("length=%.2f,area=%.2f,volume=%.2f\n",length,area,volume); }A.PI=3.1415926B.Const PI=3.14159C.#define PI3.1415926D.Float PI=3.14159

若有以下程序:include using namespace std;define PI 3.14class Point {private: i 若有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int B) { x=a; y=b; } int getx() { return x; } int gety() { reurn y; } }; class Circle: public Point { private: int r; public: Circle(int a,int b.int C) :Point(a,B) r=c; int getr() { return r; } double area() { return PI*r*r; } }; int main() { Circle cl(5,7,10); cout<<c 1 .area()<<end1; return 0; } 程序执行后的输出结果是A.314B.157C.78.5D.153.86

当执行下列宏定义命令后,S的值为 ( ) # defineR3.0 # define PI 3.1415926 # define L2 * PI * R # define S PI * R * RA.3.1415926B.18.849556C.3D.28.2743334

Refer to the exhibit. What additional commands should be used to configure OSPF area 5 as a Totally Stubby area? () A. area 0 stub o n routers R4 and R5B. area 5 stub on routers R4 and R5C. area 5 stub no - summary on routers R4 and R5D. area 0 stub no - summary on router R4 and area 5 stub no - summary on router R5E. area 5 stub no - summary on router R4 and area 5 stub on router R5

Refer to the exhibit. During the process of configuring a virtual link to connect area 2 with the backbone area, the network administrator received this console message on R3:*Mar 1 00:2 5:01.084: %OSPF -4- ERRRCV: Received invalid packet: mismatch area ID, from backbone area must be virtual link but not found from 20.20.20.1, Serial 0 .How should the virtual link be configured on the OSPF routers to establish full connectivity between the areas?()A.R1(config - router)# area 0 virtual - link 1.1.1.1R3(config - router)# area 2 virtual - link 3.3.3.3B.R1(config - router)# area 1 virtual - link 2.2.2.2 R3(config - router)# area 1 virtual - link 2.2.2.2C.R1(config - router)# area 1 virtual - link 20.20 .20.2 R3(config - router)# area 1 virtual - link 30.30.30.2D.R1(config - router)# area 1 virtual - link 30.30.30.3 R3(config - router)# area 1 virtual - link 20.20.20.1E.R1(config - router)# area 1 virtual - link 3.3.3.3 R3(config - router)# area 1 virtual - link 1.1 .1.1

翩然piān rán

设实型变量pi已赋值为3.14159,下面不能输出3.14的语句是()A、write(pi:0:2)B、writeln(pi:1:2)C、write(pi:2:2)D、writeln(pi:2)

R1, an ABR between backbone area 0 and area 1, has intra - area routes in area 0 for 10.1.1.0/24,10.1.2.0/24, and 10.1.3.0/24. These routes have metrics of 21, 22, and 23, respectively. An engineer then adds the area 0 r ange 10.1.0.0 255.255.0.0 command under the OSPF process of R1. Which of the following is true?()A、R1 loses and then re - establishes neighborships with all neighbors.B、R1 no longer advertises 10.1.1.0/24 to neighbors into area 1.C、R1 advertises a 1 0.1.0.0/16 route into area 1 with a metric of 23 (largest metric).D、R1 advertises a 10.1.0.0/16 route into area 1 with metric of 21 (lowest metric).

在立体图形中,(1/3*S*h)*(4*pi*R2)/S公式是用来计算()

在PDSN上,PI接口需划分多个VLAN接口,PI-0、PI-1和PI-2,而R-P接口不用划分PI-0、PI-1和PI-2接口。

对于在代码中经常要用到的且不会改变的值,可以将其声明为常量。如圆周率PI始终为3.14。现在要声明一个名为PI的圆周率常量,下面哪段代码是正确的()。A、const float PI;PI=3.14f;B、const float PI=3.14f;C、float const PI;PI=3.14f;D、float const PI=3.14f;

设R(Pi)表示进程Pi执行时必须读变量的语句集合,W(Pi)表示Pi执行时必须写变量的语句集合。现在有P1和P2两个进程,若要这两个进程并发,必须满足()A、R(P1)与W(P2)的交集为空B、W(P1)与W(P2)的交集为空C、R(P1)与R(P2)的交集为空D、W(P1)与R(P2)的交集为空

名词解释题翩然piān rán

多选题设R(Pi)表示进程Pi执行时必须读变量的语句集合,W(Pi)表示Pi执行时必须写变量的语句集合。现在有P1和P2两个进程,若要这两个进程并发,必须满足()AR(P1)与W(P2)的交集为空BW(P1)与W(P2)的交集为空CR(P1)与R(P2)的交集为空DW(P1)与R(P2)的交集为空