网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

如果执行以下代码,会输出什么值: from traits.api import HasTraits, Color class Circle(HasTraits): color = Color c = Circle() c.color = 'blue' print(c.color.getRgb())

A.(255,0,0,255)

B.(0,255,0,255)

C.(0,0,255,255)

D.(255,255,255,255)


参考答案和解析
输出结果如下: 产生零除异常! 在执行finally块中的语句…
更多 “如果执行以下代码,会输出什么值: from traits.api import HasTraits, Color class Circle(HasTraits): color = Color c = Circle() c.color = 'blue' print(c.color.getRgb())A.(255,0,0,255)B.(0,255,0,255)C.(0,0,255,255)D.(255,255,255,255)” 相关考题
考题 ● 以下CSS 选择符定义中, (61) 属于类选择符。A. P {color:red; font-size:12pt } B. p.blue{color:blue}C. #Red{color:red;} D. P EM { background: yellow }

考题 设有说明var color:(red,green,yellow,blue);a:boolean;下面语句正确的是( )。 Aolor:=‘green‘;Bwriteln(green);Cwriteln(color);Da:=color=red;

考题 ● 以下CSS 选择符定义中, (61) 属于类选择符。(61)A. P {color:red; font-size:12pt }B. p.blue{color:blue}C. #Red{color:red;}D. P EM { background: yellow }

考题 以下选项中不能正确把c1定义成结构体变量的是A.typedef struct {int red: int green: int blue; } COLOR; COLOR c1;B.struct color c1 {int red int green: int blue; };C.struct color {int red , int green : int blue : )cl;D.struct {int red; int green; int blue } c1 ;

考题 classSock2{Stringcolor;publicbooleanequals(Objecto){returncolor.equals(((Sock2)o).color);}}classTestSocks{publicstaticvoidmain(String[]args){Sock2s1=newSock2();s1.color=blue;Sock2s2=newSock2();s2.color=blue;if(s1.equals(s2))System.out.print(equals);if(s1==s2)System.out.print(==);}}结果为:()A.==B.equalsC.equals==D.无结果输出

考题 publicclassBall{publicenumColor{RED,GREEN,BLUE};publicvoidfoo(){//insertcodehere{System.out.println(c);}}}Whichcodeinsertedatline14causesthefoomethodtoprintRED,GREEN,andBLUE?() A.for(Colorc:Color.values())B.for(Colorc=RED;c=BLUE;c++)C.for(Colorc;c.hasNext();c.next())D.for(Colorc=Color[0];c=Color[2];c++)E.for(Colorc=Color.RED;c=Color.BLUE;c++)

考题 packagesun.scjp;publicenumColor{RED,GREEN,BLUE}packagesun.beta;//insertcodeherepublicclassBeta{Colorg=GREEN;publicstaticvoidmain(String[]argv){System.out.println(GREEN);}}TheclassBetaandtheenumColorareindifferentpackages.Whichtwocodefragments,insertedindividuallyatline2oftheBetadeclaration,willallowthiscodetocompile?()A.importsun.scjp.Color.*;B.importstaticsun.scjp.Color.*;C.importsun.scjp.Color;importstaticsun.scjp.Color.*;D.importsun.scjp.*;importstaticsun.scjp.Color.*;E.importsun.scjp.Color;importstaticsun.scjp.Color.GREEN;

考题 以下选项中不能正确把cl定义成结构体变量的是A.typedef struct { int red; int green; int blue; } COLOR; COLOR cl;B.struct color cl { int red; int green; int blue; }C.struct color { int red; int green; int blue; } cl;D.struct { int red; int green; int blue; } cl;

考题 下面哪个CSS属性是用来更改背景颜色的()。A.background-color:B.bgcolor:C.color:D.text:

考题 以下选项中不能正确把c1定义成结构体变量的是A.typedef struct { int red; int green;; int blue; }COLOR; COLOR cl;B.struct color cl { int red; int green; int blue; };C.struet color { int red; int green; int blue; }c1;D.struct { int red; int green; int blue; }cl;

考题 下列程序中,先声明一个圆类circle和一个桌子类table,另外声明一个圆桌类roundtable,它是由 circle和table两个类派生的,要求声明一个圆桌类对象,并输出圆桌的高度,面积和颜色。请填空完成程序include<iostream.h>include<string.h>class circle{double radius;public:circle(double r){radius=r;}double get_area(){return 3.416*radius*radius;}};class table{double height;public:table(double h)<height=h;}double get_height(){return height;}};class roundtable:public table,public circle{char *color;public:roundtable(double h,double r,char c[]): 【 】 {color=new char[strlen(c) +1];【 】;};char*get_color(){return color;}}:void main(){roundtable rt(0.8,1.0,“白色”);cout<<"圆桌的高:"<<rt. get_height()<<end1;cout<<"圆桌面积:"<<rt.get_area()<<end1;cout<<"圆桌颜色:"<<n.get color()<<end1;}

考题 本题的功能是用按钮来控制文字的颜色。窗口中有三个按钮“Yellow”、“Blue”和“Red”,它们分别对应文字标签中文本的颜色为黄色、蓝色和红色,单击任意一个按钮,文字标签中的文本就变成按钮对应的颜色。 import java.awt.*; import java.awt.event.*; import javflx.swing.*; class ButtonPanel extends JPanel implements ActionL- istener{ public ButtonPanel{ yellowButton=new J Button("Yellow"); blueButton=new JButton("Blue"); redButton=new JButton("Red"); j1=new JLabel("I am from China!"); add(yellowButton); add(blueButton); add(redButton); add(j1); yellowButtofl.addActionListener(this); blueButton.addActionListener(this); redButton.addActionListener(this); } public void actionPerformed(ActionEvent evt){ 0bject source=evt.getSource; Color color=getForeground; if(source= =yellowButton)color=Color. yellow; else if(source= =blueButton)color=Color. blue; else if(source= =redButton)color= Color.red; ; ; } private JButton yellowButton; private JButton blueButton; private JButton redButton; private JLabel jl; } class ButtonFrame. extends JFrame{ public ButtonFrame{ setTitle("exam l6"); setSize(300,200); addWindowListener(new WindowAdapter{ public void windowClosing(WindowEvent e){ System.exit(O); } }); Container contentPane=getContentPane; contentPane.add(new ButtonPanel); } } public class java2{ public static void main(String[]args){ JFrame. frame=new ButtonFrame; frame.show; } }

考题 下列Applet在坐标(30,50)处以黄色字体显示“你好!”。请选择正确的语句填入横线处。 import java.awt.*; import java.applet.*; public class ex27 extends Applet { public void paint<Graphics g) { g.drawString("你好", 30, 50); } }A.setColor(Color.yellow);B.g.setColor(Color. Yellow),C.g.setFontColor(Color. yellow);D.g.setColor(Color. yellow);

考题 下列选项中不能正确定义结构体的是_______。A.typedef structB.struct color cl {int red; {int red; int green; int green; int blue; int blue; }COLOR; }; COLOR cl;C.struct colorD.struct {int red; {int red; int green; int green; int blue; int blue; }cl; }cl;

考题 阅读下列说明和 C++代码,填补代码中的空缺,将解答填入答题纸的对应栏内。 【说明】 设计 RGB 方式表示颜色的调色板,进行绘图,其类图如图 5-1 所示。该程序的 C++代码附后。图5-1 类图【C++代码】 include iostream include stdlib.h include ctime using namespace std; class MyColor{ private: int red; int green; int blue; public: MyColor() {red = 0; green = 0; blue = 0; } ~MyColor() { } MyColor(int red ,int green ,int blue) { this-red = red; this-green = green; this-blue = blue;} //其他方法略 void print() { coutRed: red \tGreen: green \tBlue blue endl; } }; class Palette ( private: int number; MyColor** palette; public: Palette() { number = 256; palette = (MyColor*)malloc (sizeof(MyColor ) *number); } ~Palette () { for (int i = 0; i number; i++) { delete palette[i]; } (1) ; } Palette(MyColor** pale ,int number) { (2) = number; palette = (MyColor**)malloc(sizeof(MyColor*)*number) ; memcpy(palette ,pale ,sizeof(pale)*number); } //其他方法略 void print () { for (int i = 0; i number; i++) { cout i : ; palette[i]-print(); } } }; class Drawing{ public: (3) int COLORNUMBER = 16; public: ~Drawing () { } void draw() ( Palette* palette; int red ,green ,blue; MyColor* color[COLORNUMBER); srand((unsigned)time(O)); for (int i = 0; i COLORNUMBER; i++) red=rand ()% 256; green = rand() % 256; blue = rand ()% 256; color [i) = (4) (red ,green ,blue); } palette = new Palette(color ,COLORNUMBER); palette-print(); for (int i = 0; i COLORNUMBER; i++) delete color[i]; } }; int main () { Drawing * d = (5) ; d-draw(); delete d; }

考题 以下CSS选择符定义中,______属于类选择符。 A.P{color:red; font-size:12pt} B.p.blue{color:blue} C.#Red{color:red;) D.PEM {background: yellow}

考题 以下哪段代码是获取控件内文本的颜色()。A、var color = aa.style.colorB、aa.style.color = ‘blue’C、var width = aa.borderWidthD、var style = aa.style.borderBottomStyle

考题 在J2EE中,对于简单属性的方法: public Color getColor(){…} 和public Void setColor(Color c){…} 假定color是类中的属性,在方法体内可以() A、  在getColor方法体内只能有一行代码:return color; 在setColor方法体内只能有一行代码: this.color=c;B、  在getColor方法体内只能有一行代码:return color; 在setColor方法体内一定有该行代码: this.color=c;但还可以有其他的代码C、  在getColor方法体内一定有该行代码:return color; 但还可以有其他的代码, 在setColor方法体内只能有该行代码: this.color=c;D、  在getColor方法体内一定要有该行代码:return color; 但还可以有其他的代码,在setColor方法体内一定有该行代码: this.color=c;但还可以有其他的代码

考题 现自:  1.  interface Color {  }      2. interface Weight  {  }      3.  //insert code here    和以下足六个声明:  class Boat extends Color, extends Weight  {  }     class Boat extends Color and Weight  {  }      class Boat extends Color, Weight  {  }  class Boat implements Color,  implements Weight  {  }     class Boat implements Color and Weight  {  }      class Boat implements Color, Weight  {  }    分别插入到第3行,有多少行可以编译? () A、  0B、  1C、  2D、  3

考题 下列代码段是某页面的样式设置: STYLE TYPE=”text/css”.blue{color:blue}.red{color:red} /STYLE现要求将页面中的第一个H1标题设置为红色,第一个段落设置为蓝色.下列代码正确的是()A、H1 id=red第一个标题/H1P id=blue第一个段落/p B、H1 color:red第一个标题/H1P color:blue第一个段落/p C、H1 class=red第一个标题/H1P class=blue第一个段落/p D、H2 class=red第一个标题/H2H1第一个标题H1P id=blue第一个段落/p

考题 package sun.scjp;  public enum Color { RED, GREEN, BLUE }  package sun.beta;  // insert code here  public class Beta {  Color g = GREEN;  public static void main( String[] argv)  { System.out.println( GREEN); }  }  The class Beta and the enum Color are in different packages.  Which two code fragments, inserted individually at line 2 of the Beta declaration, will allow this code to compile?()A、 import sun.scjp.Color.*;B、 import static sun.scjp.Color.*;C、 import sun.scjp.Color; import static sun.scjp.Color.*;D、 import sun.scjp.*; import static sun.scjp.Color.*;E、 import sun.scjp.Color; import static sun.scjp.Color.GREEN;

考题 现有:  1. abstract class Color  {  2.protected abstract  String getRGB();     3.  }     4.  5. public class Blue extends Color  {     6.    //insert code here      7.  }  和四个声明:  public String getRGB()  {  return "blue";  }      String getRGB()  {  return  "blue";  )  private  String getRGB()  {  return  "blue";  }      protected String getRGB()  {  return "blue";  )      分别插入到第6行,有几个可以通过编译?()    A、  0B、  1C、  2D、  3

考题 You work as a Web Developer at Certkiller.com. You make use of Microsoft ASP.NET 3.5 in orderto create a Web Site.  In a separate code file you create the following class:  public static class _Colors {  public static Color NormalActivityColor = Color.Green;  public static Color WarningActivityColor = Color.Yellow;  public static Color ErrorActivityColor = Color.Red;    public static Color GetRandomColor()  {  Random random = new Random((int)DateTime.Now.Ticks);  int randomArgbValue = random.Next();  Color color = Color.FromArgb(255, Color.FromArgb(randomArgbValue));  return color;  }  }  You need to ensure that the class is consumed by the Web Site. You have to configure the WebSite project.  What should you do?()A、You should add the file to the App_Code folder of the project.B、You should add a Register directive that will reference the file to every page that makes use ofthe class.C、This can be accomplished by referencing the file in the assemblies segment of the Web.configfile.D、This can be accomplished by referencing the file in the httpHandlers segment of the Web.configfile.

考题 单选题public class Ball {  public enum Color { RED, GREEN, BLUE };  public void foo() {  // insert code here  { System.out.println(c); }  }  }  Which code inserted at line 14 causes the foo method to print RED, GREEN, and BLUE?()A  for( Color c : Color.values())B  for( Color c = RED; c = BLUE; c++)C  for( Color c; c.hasNext() ; c.next())D  for( Color c = Color[0]; c = Color[2]; c++)E  for( Color c = Color.RED; c = Color.BLUE; c++)

考题 单选题class Sock2 {   String color;   public boolean equals(Object o) {   return color.equals(((Sock2)o).color);   } }   class TestSocks {   public static void main(String [] args) {   Sock2 s1 = new Sock2(); s1.color = "blue";   Sock2 s2 = new Sock2(); s2.color = "blue";   if (s1.equals(s2)) System.out.print("equals ");   if (s1 == s2) System.out.print("== ");   }   }   结果为:()A ==B equalsC equals ==D 无结果输出

考题 单选题以下哪段代码是获取控件内文本的颜色()。A var color = aa.style.colorB aa.style.color = ‘blue’C var width = aa.borderWidthD var style = aa.style.borderBottomStyle

考题 单选题现自:  1.  interface Color {  }      2. interface Weight  {  }      3.  //insert code here    和以下足六个声明:  class Boat extends Color, extends Weight  {  }     class Boat extends Color and Weight  {  }      class Boat extends Color, Weight  {  }  class Boat implements Color,  implements Weight  {  }     class Boat implements Color and Weight  {  }      class Boat implements Color, Weight  {  }    分别插入到第3行,有多少行可以编译? ()A   0B   1C   2D   3

考题 多选题package sun.scjp;  public enum Color { RED, GREEN, BLUE }  package sun.beta;  // insert code here  public class Beta {  Color g = GREEN;  public static void main( String[] argv)  { System.out.println( GREEN); }  }  The class Beta and the enum Color are in different packages.  Which two code fragments, inserted individually at line 2 of the Beta declaration, will allow this code to compile?()Aimport sun.scjp.Color.*;Bimport static sun.scjp.Color.*;Cimport sun.scjp.Color; import static sun.scjp.Color.*;Dimport sun.scjp.*; import static sun.scjp.Color.*;Eimport sun.scjp.Color; import static sun.scjp.Color.GREEN;