STRING DB‘ABCDEFGHIJ&

题目

STRING DB‘ABCDEFGHIJ’ MOVAH,01从键盘输入字符1~9 INT21H ANDAL,0FH DECAL XORAH,AH MOVBX,OFFSETSTRING ADDBX,AX MOVBL,[BX] MOVAH,02H ;显示输出 INT21H : 试回答: 如从键盘输入字符‘4’,程序段有什么结果?

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Given:Which regular expression, inserted at line 12, correctly splits test into "Test A", "Test B", and "Test C"?()

A.String regex="";

B.String regex=" .";

C.String regex=".*";

D.String regex="\\s";

E.String regex="\\.\\s*";

F.String regex="\\w[\.]+";


参考答案:E

第2题:

下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i, String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String [] args){ print(99,"Int first"); } }

A.String:Stringfirst,int:11

B.int:11,String:Int first

C.String:String first,int:99

D.int:99,String:int first


正确答案:D
解析:本题考查考生阅读程序的能力。JavaApplication都是以main()方法作为入口,首先执行的是print(99,“Intfirst”),根据构造方法的参数类型选择调用方法,这里调用的是print(inti,Strings)方法,因此输出的是int:99,String:Intfirst。

第3题:

下面的哪些程序段可能导致错误? ( ) Ⅰ: String s = "Gone with the wind"; String t = "good "; String k = s + t; Ⅱ: String s = "Gone with the wind"; String t; t = s[3] + "one"; Ⅲ: String s = "Gone with the wind"; String standard = s.toUpperCase(); Ⅳ: String s = "home directory"; String t = s-"directory":

A.Ⅱ、Ⅲ

B.Ⅱ、Ⅳ

C.Ⅰ、Ⅳ

D.Ⅲ、Ⅳ


正确答案:B
解析:本题是考杳对String操作符的理解和应用。Ⅰ段中,String类型可以直接使用+进行连接运算:Ⅱ段中,String是一种Object,而不是简单的字符数组,不能使用下标运算符取其值的某个元素,错误;Ⅲ段中, toUppelCase0方法是String对象的一个方法,作用是将字符串的内容全部转换为大写并返回转换后的结果(String类型);IV段中,String类型不能进行减(—)运算,错误。

第4题:

Given:Andthefollowingfivefragments:publicstaticvoidmain(String...a){publicstaticvoidmain(String.*a){publicstaticvoidmain(String...a){publicstaticvoidmain(String[]...a){publicstaticvoidmain(String...[]a){Howmanyofthecodefragments,insertedindependentlyatline2,compile?()

A.0

B.1

C.2

D.3

E.4


参考答案:D

第5题:

已知String类定义如下:

class String

{

public:

String(const char *str = NULL); // 通用构造函数

String(const String &another); // 拷贝构造函数

~ String(); // 析构函数

String & perater =(const String &rhs); // 赋值函数

private:

char *m_data; // 用于保存字符串

};

尝试写出类的成员函数实现。


正确答案:

 

String::String(const char *str)
{
if ( str == NULL ) //strlen在参数为NULL时会抛
异常才会有这步判断
{
m_data = new char[1] ;
m_data[0] = '\0' ;
}
else
{
m_data = new char[strlen(str) + 1];
strcpy(m_data,str);
}
}
String::String(const String &another)
{
m_data = new char[strlen(another.m_data) + 1];
strcpy(m_data,other.m_data);
}
String& String::operator =(const String &rhs)
{
if ( this == &rhs)
return *this ;
delete []m_data; //删除原来的数据,新开一块内

m_data = new char[strlen(rhs.m_data) + 1];
strcpy(m_data,rhs.m_data);
return *this ;
}
String::~String()
{
delete []m_data ;
}

第6题:

下列的哪个程序段可能导致错误? ( )

A.String s="hello"; String t="good"; String k=s+t;

B.String s="hello"; String t; t=s[3]+"one";

C.String s="hello"; String standard=s.toUpperCase();

D.String s="hello"; String t=s+"good";


正确答案:B

第7题:

下列字符串中非法字符串为( )。

A.’a string’

B.’It is a’string’.’

C.”a string”

D.”It is a’string”


正确答案:B

第8题:

下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i,String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String[]args){ print(99,"Int first"); } }

A.String:String first,int:11

B.int:11,String:Int first

C.String:String first,int99

D.int:99,String:Int first


正确答案:D
解析:本题考查考生阅读程序的能力。JavaApplication都是以main()方法作为入口,首先执行的是print(99,"Int first"),根据构造方法的参数类型选择调用方法,这里调用的是print(int i,String s)方法,因此输出的是int:99,String:Int first。

第9题:

编写类 String 的构造函数、析构函数和赋值函数

已知类 String的原型为:

class String

{

public:

String(const char *str = NULL); // 普通构造函数

String(const String &other); // 拷贝构造函数

~ String(void); // 析构函数

String & perate =(const String &other); // 赋值函数

private:

char *m_data; // 用于保存字符串

};

请编写 String的上述 4 个函数。


正确答案:
 

第10题:

若要在变量名为STRING的数据中顺序存放数据‘A’、‘B’、‘C’、‘D’、‘E’、‘F’、‘G’、‘H’,写出分别用伪指令DB,DW和DD实现存放数据的汇编语句。


正确答案: STRING  DB  ‘ABCDEFGH’
STRING  DW  ‘BADCFEHG’
STRING  DD  ‘DCBAHGFE’

更多相关问题