网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
创建一个对象obj,该对象包含一个名为"name"的属性,其值为"value"。以下哪一段JavaScript代码无法得到上述的结果()
- A、 var obj = new Object();obj["name"] = "value";
- B、 var obj = new Object();obj.prototype.name = "value";
- C、 var obj = {name : "value"};
- D、 var obj = new function() { this.name = "value";}
参考答案
更多 “创建一个对象obj,该对象包含一个名为"name"的属性,其值为"value"。以下哪一段JavaScript代码无法得到上述的结果()A、 var obj = new Object();obj["name"] = "value";B、 var obj = new Object();obj.prototype.name = "value";C、 var obj = {name : "value"};D、 var obj = new function() { this.name = "value";}” 相关考题
考题
有如下程序#includeusing namespace std;class Obj{static int i;public:Obj(){i++;}~Obj(){i--;}static int getVal(){teturn i;}};int Obj::i=0;void f (){Obj ob2;coutObj obl;F();Obj*ob3=new Obj;coutDelete ob3;cout}程序的输出结果是______。A.232B.231C.222D.221
考题
( 29 ) 有如下程序 :#includeusing namespace std;class Obj{static int i;public:Obj( ){ i++; }~Obj( ){ i--; }static int getVal( ){ return i;}};int Obj::i=0;void f(){Obj ob2; coutint main( ){Obj ob1;f( );Obj *ob3=new Obj; coutgetVal( );delete ob3; cout return 0;}程序的输出结果是A ) 232B ) 231C ) 222D ) 221
考题
请使用VC6或使用【答题】菜单打开考生文件夹projl下的工程projl,该工程含有一个源程序文件pn,jl.cpp。其中位于每个注释“//ERROR 木}}水found}}水木”之后的一行语句存在错误。请改正这些错误,使程序的输出结果为: The value is 10 注意:只修改注释“//ERROR **** found****”的下一行语句,不要改动程序中的其他内容。 //pmjl.cpp includeiostream using namespace std; class MyClass{ int value; public: //ERROR********found********* void MyClass(int val):value(val){} int GetValueconst{return value;} void SetValue(int val); }; //ERROR********found******** inline void SetValue(int val){value=val;} int main MyClass obj(O); obj.SetValue(10); //ERROR********found********下列语句功能是输出obj的成员value的值 tout”The value is”obj.valueendl: return 0; }
考题
如果程序里有叫obj1和obj2的对象,当使用语句“obj2=obj1;”时的结果是( )。A.在obj2中的实例变量被赋予obj1中相同的值B.obj2和obj1被认为是同一个变量C.obj2的值赋给了obj1,而obj2为空D.以上都不对
考题
若有如下类定义: class B { void fun1() { protected: double var1; public: void fun2() { }, class D: public B protected: void fun3() { };已知obj是类D的对象,下列语句中不违反类成员访问控制权限的是A.obj.fun1();B.obj.varl;C.obj.fun2();D.obj.fun3();
考题
把一个对象写到一个流中相对比较简单,具体是通过调用ObjectOutputStream类的writeObject()方法实现的,那么该方法的定义为( )。A.public final int writeObject(Object obj) throws IOExceptionB.public final void writeObject(Object obj) throws IOExceptionC.public Object writeObject(Object obj) throws IOExceptionD.public final Object writeObject(Object obj) throws IOException
考题
下列程序在Frame中设定BorderLayout布局管理器,选择正确的语句填入程序的横线处。 import java.awt.*; public class ex43 extends Frame { public static void main(String[] args) { ex43 bj = new ex43("BorderLayout"); ______ obj.add("North", new Button("North")); obj.add("South", new Button("Sourth")); obj.add("East", new Button ("East")); obj.add("West", new Button ("West")); obj. add ("Center", new Button ( "Center" ) ); obj.pack(); obj. setVisible (true); } public ex43(String str) { super (str); } }A.obj.setLayout(new BorderLayout());B.setLayout(new Borderkayout());C.setLayout(BorderLayout());D.obj.setLayout(BorderLayout());
考题
有如下程序; public class MethTest { static int Varl=100; int Var2=200; public static void main(String args[]) { Varl=10; MethTest Obj1=new MethTest(); MethTest Obj2=new MethTest(); Obj1.Varl++; System.out.println(Objl.Varl); Obj2.Varl++; System.out.println(Obj2.Varl); MethTest.Varl++; System.out.println(Objl.Varl); Obj1.Var2++; System.out.println(Obj1.Var2); Obj2.Var2++; System.out.println(Obj2.Var2); } } 程序的运行结果为( )。A.11 12 13 201 201B.101 102 103 201 201C.11 12 13 201 202D.10 10 10 201 201
考题
以下程序的执行结果为()。includeclass myClass{Dublic:myClass(intdata) ;myClass(
以下程序的执行结果为( )。 #include<iostream.h> class myClass { Dublic: myClass(int data) ; myClass(){value=0; }; myClass(myClass obj); void print(){ cout<<value<<end1; } ~myClass(){} private: int value; }; myClass::myClass(int data) {value=data; } myClass::myClass(myClass Obj) { value=obj.value; } void main() { myClass a(100); myClass b(a) ; b.print(); }A.0B.100C.10D.程序编译时出错
考题
设有如下代码:interface IFace{}class CFace implements IFace{}class Base{}public class ObRef extends Base{public static void main(String argv[]){ObRef bj = new ObRef();Base b = new Base();Object obj1 = new Object();IFace obj2 = new CFace();//Here}}则在 //Here处插入哪个代码将不出现编译和运行错误。A.obj1=obj2;B.b=obj;C.obj=b;D.obj1=b;
考题
以下为一段浏览器中可运行的Javascript代码,则运行该段Javascript代码的页面弹出框中显示的结果是:() 1 var obj = {"key":"1","value":"2"}; 2 var newObj = obj; 3 newObj.value += obj.key; 4 alert(obj.value);A、2B、12C、3D、21
考题
创建一个对象obj,该对象包含一个名为"name"的属性,其值为"value"。以下哪一段JavaScript代码无法得到上述的结果?()A、varobj=new Object();obj["name"]="value";B、var obj=new Object();obj.prototype.name="value";C、var obj={name:"value"};D、var obj=new function(){this.name="value";}
考题
void waitForSignal() { Object obj = new Object(); synchronized (Thread.currentThread()) { obj.wait(); obj.notify(); } } Which is true?() A、 This code may throw an InterruptedException.B、 This code may throw an IllegalStateException.C、 This code may throw a TimeoutException after ten minutes.D、 This code will not compile unless “obj.wait()” is replaced with “((Thread) obj).wait()”.E、 Reversing the order of obj.wait() and obj.notify() may cause this method to complete normally.F、 A call to notify() or notifyAll() from another thread may cause this method to complete normally.
考题
以下装箱、拆箱语句中,错误的有()A、 object obj=100; int m=(int)obj;B、 object obj=100; int m=obj;C、 object obj=(int)100; int m=(int)obj;D、 object obj=(object)100; int m=(int)obj;
考题
C#中TestClass为一自定义类,其中有以下属性定义: publicvoidProperty{…}开卷考 使用以下语句创建了该类的对象,并使变量obj引用该对象: TestClassobj=newTestClass(); 那么,可通过什么方式访问类TestClass的Property属性?()A、Obj,PropertyB、MyClass.PropertyC、obj::PropertyD、obj.Property()
考题
In a JSP-centric shopping cart application, you need to move a client’s home address of the Customerobject into the shipping address of the Order object. The address data is stored in a value object classcalled Address with properties for: street address, city, province, country, and postal code. Which two JSPcode snippets can be used to accomplish this goal?()A、c:set var=’order’ property=’shipAddress’value=’${client.homeAddress}’ /B、c:set target=’${order}’ property=’shipAddress’value=’${client.homeAddress}’ /C、jsp:setProperty name=’${order}’ property=’shipAddress’ value=’${client.homeAddress}’ /D、c:set var=’order’ property=’shipAddress’jsp:getProperty name=’client’ property=’homeAddress’ / /c:storeE、c:set target=’${order}’ property=’shipAddress’jsp:getProperty name=’client’ property=’homeAddress’ / /c:set
考题
Which HttpSession method stores an object in a session?()A、 put(String name. Object value)B、 set(String name. Object value)C、 setAttribute(String name. Object value)D、 putAttribute(String name. Object value)E、 addAttribute(String name. Object value)
考题
Assume the scoped attribute priority does NOT yet exist. Which two create and set a new request-scopedattribute priority to the value "medium"?()A、${priority = ’medium’}B、${requestScope[’priority’] = ’medium’}C、c:set var="priority" value="medium" /D、c:set var="priority" scope="request"medium/c:setE、c:set var="priority" value="medium" scope="request" /
考题
单选题创建一个对象obj,该对象包含一个名为"name"的属性,其值为"value"。以下哪一段JavaScript代码无法得到上述的结果?()A
varobj=new Object();obj[name]=value;B
var obj=new Object();obj.prototype.name=value;C
var obj={name:value};D
var obj=new function(){this.name=value;}
考题
多选题Assume the scoped attribute priority does NOT yet exist. Which two create and set a new request-scopedattribute priority to the value "medium"?()A${priority = ’medium’}B${requestScope[’priority’] = ’medium’}Cc:set var=priority value=medium /Dc:set var=priority scope=requestmedium/c:setEc:set var=priority value=medium scope=request /
考题
单选题以下装箱、拆箱语句中,错误的有()A
object obj=100; int m=(int)obj;B
object obj=100; int m=obj;C
object obj=(int)100; int m=(int)obj;D
object obj=(object)100; int m=(int)obj;
考题
单选题void waitForSignal() { Object obj = new Object(); synchronized (Thread.currentThread()) { obj.wait(); obj.notify(); } } Which is true?()A
This code may throw an InterruptedException.B
This code may throw an IllegalStateException.C
This code may throw a TimeoutException after ten minutes.D
This code will not compile unless “obj.wait()” is replaced with “((Thread) obj).wait()”.E
Reversing the order of obj.wait() and obj.notify() may cause this method to complete normally.F
A call to notify() or notifyAll() from another thread may cause this method to complete normally.
考题
单选题C#中的TestClass为一自定义类,其中有如下属性定义: public void Property{……} 使用以下语句创建了该类的对象,并让变量obj引用该对象。 TestClass obj=new TestClass(); 那么,可通过()方式访问类TestClass的Property属性。A
MyClass. PropertyB
obj. PropertyC
TestClass. PropertyD
obj. Property()
考题
单选题Which HttpSession method stores an object in a session?()A
put(String name. Object value)B
set(String name. Object value)C
setAttribute(String name. Object value)D
putAttribute(String name. Object value)E
addAttribute(String name. Object value)
考题
多选题In a JSP-centric shopping cart application, you need to move a client’s home address of the Customerobject into the shipping address of the Order object. The address data is stored in a value object classcalled Address with properties for: street address, city, province, country, and postal code. Which two JSPcode snippets can be used to accomplish this goal?()Ac:set var=’order’ property=’shipAddress’value=’${client.homeAddress}’ /Bc:set target=’${order}’ property=’shipAddress’value=’${client.homeAddress}’ /Cjsp:setProperty name=’${order}’ property=’shipAddress’ value=’${client.homeAddress}’ /Dc:set var=’order’ property=’shipAddress’jsp:getProperty name=’client’ property=’homeAddress’ / /c:storeEc:set target=’${order}’ property=’shipAddress’jsp:getProperty name=’client’ property=’homeAddress’ / /c:set
考题
单选题创建一个对象obj,该对象包含一个名为"name"的属性,其值为"value"。以下哪一段JavaScript代码无法得到上述的结果()A
var obj = new Object();obj[name] = value;B
var obj = new Object();obj.prototype.name = value;C
var obj = {name : value};D
var obj = new function() { this.name = value;}
考题
( 难度:中等)以下哪条语句会产生运行错误:( )A.var obj = ( );B.var obj = [ ];C.var obj = { };D.var obj = / /;
热门标签
最新试卷