网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
以下哪种初始化数组的方式是错误的?()
- A、 String[]names={"zhang", "wang", "li");
- B、 String names[] =new String [3];names [0] ="zhang"; names [1] ="wang"; names [2] ="li";
- C、 String[3] names={"zhang", "wang", "li"};
- D、 以上皆正确
参考答案
更多 “ 以下哪种初始化数组的方式是错误的?() A、 String[]names={"zhang", "wang", "li");B、 String names[] =new String [3];names [0] ="zhang"; names [1] ="wang"; names [2] ="li";C、 String[3] names={"zhang", "wang", "li"};D、 以上皆正确” 相关考题
考题
DAnne and Joseph are talking about an interesting question. Why do some people change their names? There can be many reasons. Hanna changed her name to Anne because she thought it would be easier for people to remember. On the other hand, Joseph is thinking about changing his name to an unusual name because he wants to be different.People have a lot of reasons for changing their names. Film stars, singers, sportsmen and some other famous people often change their names because they want names that are not ordinary, or that have special sound. They chose the “new name” for themselves instead of the name their parents gave them when they were born.Some people have another reason for changing their names. They have moved to a new country and want to use a name that is usual there. For example, Li Kaiming changed his name to Ken Lee when he moved to the United States. He uses the name Ken at his job and at school. But with his family and Chinese friends, he uses Li Kaiming. For some people, using different names makes life easier in their new country.In many countries, a woman changes her family name to her husband’s after she gets married. But today, many women are keeping their own family name and not using their husband’s. Sometimes , women use their own name in some situations (情况)and their husband’s in other situations . And some use both their own name and their husband’s.根据短文内容,完成下面表格。different peoplereason to change the nameHannaIt is ____61____ for people to remember.JosephHe wants to have a name that’s ____62_____.famous peopleTheir name may sound _____63_____.Li KaimingUsing different names can make ____64_____ easier.a womanAfter she gets _____65_____, she may change her name.61._________________________________________________________________________
考题
定义结构体数组:struct stu{int num;charname[20];}x[5]={1,"LI",2,"ZHAO",3,"WANG",4,"ZHANG",5,"LIU"};for(i=1;i<5;i++)printf("%d%C",x[i].num,x[i]name[2]);以上程序段的输出结果为( )。A.2A3N4A5UB.112A3H41C.1A2N3A4UD.2H3A4H51
考题
When you meet a group of people, it is better to remember __A. all their names B. a couple of names firstC. just their last names D. as many names as possible
考题
importjava.util.*;publicclassNameList{privateListnames=newArrayList();publicsynchronizedvoidadd(Stringname){names.add(name);}publicsynchronizedvoidprintAll(){for(inti=0;iSystem.out.print(names.get(i)+);}}publicstaticvoidmain(String[]args){finalNameListsl=newNameList();for(inti=0;i2;i++){newThread(){publicvoidruin(){sl.add(”A”);sl.add(”B”);sl.add(”C”);sl.printAll();}}.start();}}}Whichtwostatementsaretrueifthisclassiscompiledandrun?()
考题
定义结构体数组: struct stu { int num; char name[20]; }x[5]={1,"LI",2,"ZHAO",3"WANG",4,"ZHANG",5"LIU"}; for(i=1;i<5;i++) printf("%d %c", x[i].num, x[i].name[2]); 以上程序段的输出结果为( ).A.2A3N4A5UB.1I2a3h4IC.1A2N3A4UD.2H3A4H5I
考题
定义结构体数组: struct stu { int num; char nameE20]; }X[5]={1,"LI",2,"ZHAO",3,"WANG",4," ZHANG",5,"LIU"); for(i=1;i5;i++) printf("%d%c",x[i].num,x[i].name[2]); 以上程序段的输出结果为( )。A.2A3N4A5UB.112A3H4IC.1A2N3A4UD.2H3A4H5I
考题
定义结构体数组:struct stu{ int num;char nameE20];}X[5]={1,LI,2,ZHAOLI,2,ZHAO,3,WANG,4, ZHANG,5,LIU);for(i=1;i5;i++)printf(%d%c,x[i].num,x[i].name[2]);以上程序段的输出结果为( )。A.2A3N4A5UB.112A3H4IC.1A2N3A4UD.2H3A4H5I
考题
阅读以下说明和 Java程序,填补代码中的空缺,将解答填入答题纸的对应栏内。 【说明】 以下Java代码实现一个简单客户关系管理系统(CRM)中通过工厂(CustomerFactory )对象来创建客户(Customer)对象的功能。客户分为创建成功的客户(RealCustomer)和空客户 (NullCustomer)。空客户对象是当不满足特定条件时创建或获取的对象。类间关系如图 5-1 所示。图5-1 类图【Java代码】 Abstract class Customer﹛ Protected String name; ( 1 )boolean isNil(); ( 2 )String getName(); ﹜ Class RealCustomer ( 3 )Customer{ Public RealCustomer(String name){ this.name=name; } Public String getName(){ return name ; } Public boolean is Nil() { return false; } ﹜ Class NullCustomer( 4 )Customer﹛ Public String getName()﹛ return Not Available in Customer Database; ﹜ Public boolean isNil() ﹛ return true; ﹜ ﹜ class Customerfactory { public String[] names = {Rob,Joe,Julie}; public Customer getCustomer(String name) { for (int i = 0; i names.length;i++) { if (names[i].( 5 ))﹛ return new RealCustomer(name); ﹜ ﹜ return ( 6 ); ﹜ ﹜ Public class CrM﹛ Public viod get Customer()﹛ Customerfactory( 7 ); Customer customer1-cf.getCustomer(Rob); Customer customer2=cf.getCustomer(Bob); Customer customer3= cf.getCustomer(Julie); Customer customer4= cf.getCustomer(Laura); System.out.println(customers) System.out.println(customer1.getName()); System.out.println(customer2getName()); System.out.println(customer3.getName()); System.out.println(customer4.getName()); ﹜ Public static viod main (String[]arge)﹛ CRM crm =new CRM(); Crm.getCustomer(); ﹜ ﹜ /*程序输出为: Customers rob Not Available in Customer Database Julie Not Available in Customer Database */
考题
下面哪一个是错误的?
A.使用len(列表名)测量元素的个数names_list=["zhangsan","lisi","wangwu"]print(len(names_list))B.使用列表名[下标]获取列表的某个元素,例如:names_list=["zhangsan","lisi","wangwu"]print(names_list[2])C.向列表中添加新元素有三个方法:append、extend、insert,例如:names_list=["zhangsan","lisi","wangwu"]names_list.append("zhaoliu")names_list.extend(["zhaoliu","liqi"])names_list.insert(1,"zhaoliu")print(names_list)D.已有列表nums=[11,22,33,44,55],使用while循环遍历列表nums=[11,22,33,44,55]i=0 whileiprint(nums[i])i+=1
考题
阅读下列说明和C++代码,填补代码中的空缺,将解答填入答题纸的对应栏内。 【说明】 以下C++代码实现一个简单的聊天室系统(ChatRoomSystem),多个用户(User)可以向聊天室(ChatRoom)发送消息,聊天室将消息展示给所有用户。类图如图6-1所表示。图6-1 类图【C++代码】 includeiostream include string using namespace std; class User { private: string name; public: User(string name){ (1) =name; } ~User(){} void setName(string name) { this-name=name; } string getName(){ return name; } void sendMessage(string message); }; class ChatRoom { . public: static void showMessage(User* user, string message) { cout[user-getName()] : messageendl; } }; void User::sendMessage(string message) { (2) (this,message); } class ChatRoomSystem{ public: . . void startup() { User* zhang = new User(John); User* li = new User(Leo); zhang-sendMessage(Hi! Leo!); li_sendMessage(Hi! John!); } void join(User* user) { (3) (HeIIo Everyone! l am+user-getName()); } . }; int main(){ ChatRoomSystem*crs= (4) ; crs-startup(); crs-join( (5) (Wayne)); delete crs; } /* 程序运行结果: [John]:Hi! Leo! [Leo]:Hi! John! [Wayne]:Hello Everyone! I am Wayne /*
考题
The Master or person in charge of a ship is required to log ______.A.the names of all persons on boardB.only the names of the crew members on boardC.only the names of passengers on boardD.information on emergency training drills
考题
Given the following six method names:(1)addListener(2)addMouseListener (3)setMouseListener(4)deleteMouseListener(5)removeMouseListener(6)registerMouseListenerHow many of these method names follow JavaBean Listener naming rules?()A、1B、2C、3D、4E、5
考题
下面关于数组声明和初始化的语句哪个有语法错误()A、int a1[]={3,4,5};B、String a2[]={"string1","string1","string1"};C、String a3[]=new String(3);D、int[][] a4=new int[3][3];
考题
Which of the following statements are true when creating NETBIOS names? ()A、 NETBIOS names can only use alphanumeric characters.B、 You can use a ’.’ in a NETBIOS name.C、 You can use an ’_’ (underscore) in a NETBIOS name.D、 NETBIOS names must be UPPERCASEE、 NETBIOS names can be a maximum of 32 characters
考题
When defining a referential constraint between the parent table T2 and the dependent table T1, which of the following is true?()A、The list of column names in the FOREIGN KEY clause can be a subset of the list of column names in the primary key of T2 or a UNIQUE constraint that exists on T2.B、The list of column names in the FOREIGN KEY clause can be a subset of the list of column names in the primary key of T1 or a UNIQUE constraint that exists on T1.C、The list of column names in the FOREIGN KEY clause must be identical to the list of column names in the primary key of T2 or a UNIQUE constraint that exists on T2.D、The list of column names in the FOREIGN KEY clause must be identical to the list of column names in the primary key of T1 or a UNIQUE constraint that exists on T1.
考题
import java.util.*; public class NameList { private List names = new ArrayList(); public synchronized void add(String name) { names.add(name); } public synchronized void printAll() { for (int i = 0; i System.out.print(names.get(i) +“ “); } } public static void main(String[] args) { final NameList sl = new NameList(); for(int i=0;i2;i++) { new Thread() { public void ruin() { sl.add(”A”); sl.add(”B”); sl.add(”C”); sl.printAll(); } }.start(); } } } Which two statements are true if this class is compiled and run?() A、 An exception may be thrown at runtime.B、 The code may run with no output, without exiting.C、The code may rum with output “A B A B C C “, then exit.D、The code may ruin with output “A A A B C A B C C “, then exit.E、 The code may rum with output “A B C A B C A B C “, then exit.F、The code may ruin with output “A B C A A B C A B C “, then exit.
考题
以下哪种初始化数组的方式是错误的?() A、String[] name =,“zhang”,”wang”,”li”-B、String*3+ names=,“zhang”,”wang”,”li”-C、String names[] =new String[3] names*0+=”wang”D、names*1+=”wang”E、names*2+=”li”F、以上皆正确
考题
单选题以下哪种初始化数组的方式是错误的?()A
String[] name =,“zhang”,”wang”,”li”-B
String*3+ names=,“zhang”,”wang”,”li”-C
String names[] =new String[3] names*0+=”wang”D
names*1+=”wang”E
names*2+=”li”F
以上皆正确
考题
单选题以下哪种初始化数组的方式是错误的?()A
String[]names={zhang, wang, li);B
String names[] =new String [3];names [0] =zhang; names [1] =wang; names [2] =li;C
String[3] names={zhang, wang, li};D
以上皆正确
考题
多选题import java.util.*; public class NameList { private List names = new ArrayList(); public synchronized void add(String name) { names.add(name); } public synchronized void printAll() { for (int i = 0; i System.out.print(names.get(i) +“ “); } } public static void main(String[] args) { final NameList sl = new NameList(); for(int i=0;iAAn exception may be thrown at runtime.BThe code may run with no output, without exiting.CThe code may rum with output “A B A B C C “, then exit.DThe code may ruin with output “A A A B C A B C C “, then exit.EThe code may rum with output “A B C A B C A B C “, then exit.FThe code may ruin with output “A B C A A B C A B C “, then exit.
考题
多选题Which of the following statements are true when creating NETBIOS names? ()ANETBIOS names can only use alphanumeric characters.BYou can use a ’.’ in a NETBIOS name.CYou can use an ’_’ (underscore) in a NETBIOS name.DNETBIOS names must be UPPERCASEENETBIOS names can be a maximum of 32 characters
考题
单选题下面关于数组声明和初始化的语句哪个有语法错误()A
int a1[]={3,4,5};B
String a2[]={string1,string1,string1};C
String a3[]=new String(3);D
int[][] a4=new int[3][3];
考题
单选题When defining a referential constraint between the parent table T2 and the dependent table T1, which of the following is true?()A
The list of column names in the FOREIGN KEY clause can be a subset of the list of column names in the primary key of T2 or a UNIQUE constraint that exists on T2.B
The list of column names in the FOREIGN KEY clause can be a subset of the list of column names in the primary key of T1 or a UNIQUE constraint that exists on T1.C
The list of column names in the FOREIGN KEY clause must be identical to the list of column names in the primary key of T2 or a UNIQUE constraint that exists on T2.D
The list of column names in the FOREIGN KEY clause must be identical to the list of column names in the primary key of T1 or a UNIQUE constraint that exists on T1.
考题
单选题The Master or person in charge of a ship is required to log().A
the names of all persons on boardB
only the names of the crew members on boardC
only the names of passengers on boardD
information on emergency training drills
热门标签
最新试卷