给出下面不完整的类代码,则横线处的语句应该为( )。 class Person { String name,department; int age; public Person (Strings) {name=s;} public Person (String s,int
A.{name=s;age=a;} public Person (String n,String d,intA){ __________ department=d; } }A)Person (n,A);
B.this (Person(n,A));
C.this(n,A);
D.this(name,age);
第1题:
A.printf("%c\n",class[3].name)
B.printf("%c\n",class[3].name[1])
C.printf("%c\n",class[2].name)
D.printf("%c\n",class[2].name[0]
第2题:
10、通过下面的代码片段来回答问题。 _________ User { var uuid:UUID var name:String init(uuid: UUID, name:String) { self.uuid = uuid self.name = name } } 下划线处可以填写哪些关键词?
A.protocol
B.struct
C.enum
D.class
第3题:
12、通过下面的代码片段来回答问题。 class People{ var name:String = "sam" var sex : Int var stature: Double = 182.1 var weight:Double = 76.8 } 这个类的构造器可以是以下的哪些选项?
A.init(name:String, stature:Double){ self.name = name self.stature = stature }#B.init(name:String, sex:Int, stature:Double, weight:Double){ self.name = name self.sex = sex self.stature = stature self.weight = weight }#C.init(sex:Int){ self.sex = sex }#D.init(name:String, sex:Int){ self.name = name self.sex = sex }第4题:
给出下列的不完整的类代码,则下列的哪个语句可以加到横线处? class Person { String name,department; int age; public Person( String n ){ name = n;} public Person( String n,int a ) { name = n;age = a;} public Person( String n,String d,int a ) { _____________ department = d; } }
A.Person(n,a);
B.this(Person(n,a) );
C.this(n,a);
D.this(name,age);
第5题:
若有如下定义,则下面能输出字母M的语句是()。struct person{ char name[9]; int age; }; struct person class[10]={"John",17,"paul",19,"Mary",18,"Adam",16};
A.printf("%cn",class[3].name);
B.printf("%cn",class[3].name[1]);
C.printf("%cn",class[2].name[1]);
D.printf("%cn",class[2].name[0]);