网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
小明想从字符串s=’name:(xiaoming)age:(32)’中提取里面的年龄32。以下哪一个做法可以拿到结果:()
- A、re.search(r’(.*)’,s).group(1)
- B、re.search(r’/((.*?)/)’,s).group(1)
- C、re.search(r’/((.*?)/)’,s).group(2)
- D、re.findall(r’/((.*?)/)’,s)[1]
参考答案
更多 “小明想从字符串s=’name:(xiaoming)age:(32)’中提取里面的年龄32。以下哪一个做法可以拿到结果:()A、re.search(r’(.*)’,s).group(1)B、re.search(r’/((.*?)/)’,s).group(1)C、re.search(r’/((.*?)/)’,s).group(2)D、re.findall(r’/((.*?)/)’,s)[1]” 相关考题
考题
有以下结构体说明、变量定义和赋值语句struct STD{ char name[10];int age;char sex;} s[5],*ps;ps=s[0];则以下 scanf 函数调用语句中错误引用结构体变量成员的是A)scanf("%s",s[0].name);B)scanf("%d",s[0].age);C)scanf("%c",(ps-sex));D)scanf("%d",ps-age);
考题
●已知有关系模式R(S_NO,S_NAME,AGE),其中S-NO表示学生的学号,类型为Char[8],前4位表示入学年份。查询所有2005年入学的学生姓名(S_NAME),SQL语句是 (24) 。(24) A.SELECT S_NAME FROM R WHERE S_NO=′2005%′B.SELECT S_NAME FROM R WHERE S_NO LIKE ′2005%′C.SELECT S_NAME FROM R WHERE S_NO=′2005%′D.SELECT S_NAME FROM R WHERE S_NO ′2005%′
考题
下列程序的输出结果为main (){union u{char *name;int age;int income;}ss.name="WANGLIONG";s.age=28;s.income=1000;printf("%d\n",s.age);}A.28B.1000C.0D.不确定
考题
有以下结构体说明、变量定义和赋值语句 struct STD { char name[10]; int age; char sex; }s[5],*ps; ps=s[0]; 则以下scanf函数调用语句中错误引用结构体变量成员的是______。A.scanf("%s",s[0].name);B.scanf("%d",s[0].age);C.scanf("%c",(ps->sex));D.scanf("%d",ps->age);
考题
本题中定义了一个带有参数的构造方法javal,并定义了一个该类的对象temp。构造方法javal有两个参数:字符串name和整型age。定义对象temp时将字符串“Tom"和整数17传递给构造方法,构造方法将这两个参数打印输出。 public class javal{ String name; int age; public static void main(String[]args){ String name="Tom"; int age=17; javal temp = ; } public javal(String name, ){ ; this.age= age; System.out.println(name+"is"+age+" years old."); } }
考题
假设有如下的记录类型: Type Student number As String name AS String age As Integer End Type 则正确引用该记录类型变量的代码是______。A.Student. name="" s. name="张红"B.Dim s As Student s. Dame="张红"C.Dim s As Type Student s. name="张红"D.Dim s As Type s. name="张红"
考题
根据下列定义,能打印出字母P的语句是( )。struct stu{char name[10];int age;};struct stu s[10]={"John",11,"Pau1",12,"Mary",11,"adam",12};A.primf("%c",s[3].name};B.primf("%c",s[3].name[1]);C.printf("%c",s[2].name[1]);D.printf("%c",s[1].name[0]);
考题
设有如下的用户定义类型: Type Student number As String name As string age As Integer End Type 则以下正确引用该类型成员的代码是______。A. Student name="李明”B.Dim s As Student s.name="李明"C.Dim s As Type Student s.name="李明"D.Dim s As Type s.name="李明"
考题
给出下列的不完整的类代码,则哪个语句可以被加到横线处? ( ) class Person{ String name,department; int age; public Person(String n){name=n;} public Person(String n,int s){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,s);D.this(name,age);
考题
设有如下的记录类型: TypeStudent number As String name AS String age As Integer End Type 则正确引用该记录类型变量的代码是( )。A.Student.name="张红"B.Dim s As Student s.name="张红"C.Dim s As Type Student s.name="张红"D.Dim s As Type s.name="张红"
考题
给出下面不完整的类代码,则横线处的语句应该为( )。 class Person { String name,department; int age; public Person (Strings) {name=s;} public Person (String s,intA.{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);
考题
下列程序执行后的结果是______。 package ch1; import java.io.*; public class ex22 { static, String filename = "ch1\kfile22.txt"; public static void main(String[] args) { try { FileWriter fr = new FileWriter(filename); PrintWriter pr = new PrintWriter(fr); String name = "xiaoming"; String phone = "123456"; String age = "12"; pr.println(name + ',' + phone + ',' + age); pr.close(); fr.close(); } catch(IOException ioe) { ioe.printStackTrace() } } }A.在包ch1 中新建一个文件file22.txt, 并且在其中写入一行字符串“xiaomingl2345612”B.在包ch1中新建一个文件file22.txt,并且在其中写入一行字符串“xiaoming, 123456,12”C.在包chi中新建一个文件file22.txt,并且在其中写入一行字符串“xiaoming'’D.抛出IOException
考题
若有如下程序: main() { char a[3][5] = {"name","age","sex"},n; for(n=0;n<3;n++) printf("%s\n",a[n]);} 则程序执行后的输出结果是( )。A.nameagesexB.nameC.nameD.name agexex ge age sex x sex
考题
下列程序的输出结果为 main() { union u {char *name; int age; int income;}s s.name="WANGLIONG"; s.age=28; s.income=1000; printf("%d\n",s.age); }A.28B.1000C.0D.不确定
考题
Person p = new Person(“张三”,23);这条语句会调用下列哪个构造方法给属性进行初始化()
A.public Person(){}B.public Person(String name,int age) { this.name = name; this.age = age; }C.public Person(int age,String name) { this.age = age; this.name = name; }D.public Person(String name) { this.name = name; }
考题
根据下列的定义,能打印出字母P的语句是( )。 struct stu {char name[10]; int age; }; struct sm s[10]={"John",11, "Pau1",12, "Mary",11, "adam",12 };A.printf("%c",s[3].name);B.printf("%c",s[3].name[1]);C.printf("%c",s[2].name[1]);D.printf("%c",s[1].name[0]);
考题
设变量 Aname(字符串型),Age(整型)分别表示一个人的姓名和年龄,要设计一个逻辑表达式,当该人姓张,并且超过60岁,则表达式的值为 True,下面正确的是A) Right(Name:1)=“张” And Age>60B) Left(Myname:Len(张")=“张" And age>60C)LetI; Name:Len(张")=张” Or age>60D)M Name ="5k"And Age>60
考题
下面哪个电子邮件可能是小明同学在新浪网的正确地址?( )A.xiaoming@sina.COrn.en
B.sina.COrn.Ca@xiaoming
C.sina.Com.Cnb-xiaoming
D.xiaoming b-sina.Corn.an
考题
public class Person { private String name, comment; private int age; public Person(String n, int a, String c) { name = n; age = a; comment = c; } public boolean equals(Object o) { if(! (o instanceof Person)) return false; Person p = (Person)o; return age == p.age name.equals(p.name); } } What is the appropriate definition of the hashCode method in class Person?() A、 return super.hashCode();B、 return name.hashCode() + age * 7;C、 return name.hashCode() + comment.hashCode() /2;D、 return name.hashCode() + comment.hashCode() / 2 - age * 3;
考题
在Person的一个派生类Employee里调用Person类的构造函数正确方式为()。A、base.Person(name,age)B、base(name,age)C、Person(name,age)D、this(name,age)
考题
单选题Given the following query:SELECT last_name, first_name, age, hire_date FROM employee WHERE age 40Which of the following clauses must be added to return the rows sorted by AGE, oldest first, and by LAST_NAME, from A to Z?()A
SORT BY age ASC, last_nameB
SORT BY age DESC, last_nameC
ORDER BY age DESC, last_nameD
ORDER BY age ASC, last_name
考题
单选题public class Person { private String name, comment; private int age; public Person(String n, int a, String c) { name = n; age = a; comment = c; } public boolean equals(Object o) { if(! (o instanceof Person)) return false; Person p = (Person)o; return age == p.age name.equals(p.name); } } What is the appropriate definition of the hashCode method in class Person?()A
return super.hashCode();B
return name.hashCode() + age * 7;C
return name.hashCode() + comment.hashCode() /2;D
return name.hashCode() + comment.hashCode() / 2 - age * 3;
考题
单选题在Person的一个派生类Employee里调用Person类的构造函数正确方式为()。A
base.Person(name,age)B
base(name,age)C
Person(name,age)D
this(name,age)
考题
单选题以下scanf函数调用语句中对结构体变量成员的不正确引用的是()。 struct node{ char name[20]; int age; int sex; }student[5],*p; p=student;A
scanf(“%s”,student[0].name);B
scanf(“%d”,student[0].age);C
scanf(“%d”,(p-sex));D
scanf(“%d”,p-age);
考题
单选题有以下程序:#include #include typedef struct{ char name[10]; char sex; int age;}STU;void fun(STU *t){ strcpy((*t).name,Tong); (*t).age++;}main(){ STU s[2] = {Hua, 'm', 18, Qin, 'f', 19}; fun(s+1); printf(%s,%d,%s,%d, s[0].name, s[0].age, s[1].name, s[1].age);}程序运行后的输出结果是( )。A
Hua,18,Tong,20B
Hua,18,Qin,19C
Tong,19,Qin,19D
Hua,19,Tong,19
热门标签
最新试卷