已知stu是Student类对象,则执行“print(stu)”时会自动执行Student类的()方法。
A.__init__
B.__str__
C.__format__
D.__print__
第1题:
设有关系模式:student(sno, sname, age, dept),现利用命令: CREATE VIEW stu AS SELECT *FROM student WHERE dept="cs"WITH CHECK OPTION 创建了一个视图。则以下SQl命令中能正确执行的是
A.UPDATE stu SET dept="maths"
B.UPDATE stu SET dept="maths"WHERE age>=20
C.INSERT INTO stu VALUES ("2004001", "John", 30, "cs")
D.INSERT INTO stu VALUES ("2004001", "John", 50, "maths")
第2题:
A.__lt__
B.__le__
C.__gt__
D.__ge__
第3题:
有如下语句: Type Student Name As String Age As Integer Sex As String End Type Dim Stu As Student With Stu .Name="张红" .Age=22 .Sex="女" End With 执行Print Stu.Age语句后的结果是
A.张红
B.22
C.“女”
D.Age
第4题:
如 Student类有属性 id , name 并且已经赋值 1,小明
我需要定义一个共有的方法,
public void aa(Object obj){
......
}
public static void main(String[] args){
Student stu = new Student();
stu.setId("1");
stu.setName("小明");
aa(stu);
}
我如何在aa方法里面获取对象具体的属性值,即:id=1 name=“小明”
建议使用比较通用的办法:
Student类里面重写toString() 方法
class Student{
public String toString(){
return "id=" + id + " name = " + name;
}
}
public void aa(Object obj){
String stuInfo = obj.toString();
}
获取参数为Object对象的具体属性,通用方法:
Student类里面重写toString() 方法
class Student{
public String toString(){
return "id=" + id + " name = " + name;
}
}
public void aa(Object obj){
String stuInfo = obj.toString();
}
第5题:
有以下说明和定义语句:struct student{int age; char num[8] ;};struct student stu [3] = { { 20, "200401" } , {21, "200402" } , {19, "200403" } };stract student * p = stu;以下选项中引用结构体变量成员的表达错误的是( )。
A.(p++) ->num
B.p- >num
C.( *p).num
D.stu[3].age
第6题:
有下列语句: struct Birthday{public int year; public int month; public int day;}; struct Student{ int no; string name; int age; public Birthday bir; }; …… Student Stu; 如果要把Stu的出生年份赋值为1988,正确的语句是()
第7题:
下述代码执行后,有几个引用变量和几个对象?() 对象声明Student stu(对象)= new Student(“Mike”); 对象定义(开辟空间) Student stua;(声明变量) Stua = stu;
第8题:
现有学生住处表Student_info,其中包括姓名(stu_name),学号(stu_id),成绩(stu_grade)。我们需要查询成绩为80分的学生姓名,要求结果按照学号降序排列。下面查询语句正确的是()。
第9题:
类Student的声明如下: package com.school class Student{ String name; int age; Student(String name,int age){ //code } void study(String subject){ / /code } } 正确调用方法study(String subject)的是哪项?()
第10题:
0
null
false
编译错误
第11题:
2个引用变量,1个对象
1个引用变量,1个对象
2个引用变量,2个对象
1个引用变量,2个对象
第12题:
2个引用变量,1个对象
1个引用变量,1个对象
2个引用变量,2个对象
1个引用变量,2个对象
第13题:
若有以下定义的语句 struct student {int age; int num;}; struct student stu[3]={{1001,20},{1002,19},{1003,21}}; main() {stmct student *p; p=stu; …} 则以下不正确的引用是
A.(p++)->num
B.p++
C.(*p).num
D.P=&stu.age.
第14题:
A.Studentstu=newStudent(“Tom”,23);stu.study(“数学”);
B.Student.study(“数学”);
C.Studentstu=newStudent(“Tom”,23);stu.study();
D.Studentstu=newStudent(“Tom”,23);Stringresult=stu.study(“数学”);
第15题:
有如下用户定义类型及操作语句: Tyoe Student SNo As String Sname As String SAge As Integer End Type Dim Stu As Student With Stu SNo=”200609001” SName=”陈果果“ A ge=19 End With 执行MsgBox Stu,Age 后,消息框输出结果是 【13】
第16题:
有以下说明和定义语句struct student{ int age; char num[8];};struct student stu[3]={{20,"200401"},{21,"200402"},{10\9,"200403"}};struct student *p=stu;以下选项中引用结构体变量成员的表达式错误的是A.(p++)->num B.p->num C.(*p).num D.stu[3].age
第17题:
设有关系模式:student(sno,sname,age,dept),现利用命令: CREATE VIEW stu AS SELECT * FROM student WHERE dept="cs"WITH CHECK OPTION创建了一个视图。则以下SQL命令中能正确执行的是( )。
A.UPDATE stu SET dept="maths"
B.UPDATE stu SET dept="maths"WHERE age>=20
C.INSERT INTO stu VALUES("2004001","John",30,"CS")
D.INSERT INTO stu VALUES("200400l","John",50,"maths")
第18题:
类Student代码如下: class Student{ String name; int age; Student(String nm){ name = nm; } } 执行语句Student stu = new Student()后,字段age的值是哪项?()
第19题:
有以下说明语句:struct Student{int num;double score;};Student stu[3]={{1001,80},{1002,75},{1003,91}},*p=stu;则下面引用形式错误的是()
第20题:
下述代码执行后,有几个引用变量和几个对象?() Student stu = new Student(“Mike”); Student stua; Stua = stu;
第21题:
类Student代码如下:D class Student{ String name; int age; Student(String nm){ (构造方法) name = nm; } } 执行语句Student stu = new Student()后,字段age的值是哪项?()
第22题:
p->num
(p++).num
(p++)->num
(*p).num
第23题:
0
null
false
编译错误
第24题:
Student stu = new Student(“Tom”,23); stu.study(“数学”);
Student.study(“数学”);
Student stu = new Student(“Tom”,23); stu.study();
Student stu = new Student(“Tom”,23); String result=stu.study(“数学”);