智慧树知到《SqlServer数据库原理与应用》章节测试答案
智慧树知到《SqlServer数据库原理与应用》章节测试答案
第一章单元测试
1、关系数据库是若干()的集合。
A.表(关系)
B.视图
C.行
D.列
正确答案:表(关系)
2、()是位于用户和操作系统之间的一层数据管理软件,数据库在建立、使用和维护时由其统一管理、统一控制。
A.DBMS
B.DB
C.DBS
D.DBA
正确答案:DBMS
3、在SQL Server中,不是对象的是()
A.用户
B.数据
C.表
D.数据类型
正确答案:数据类型
4、SQL ;SERVER数据库类型有很多种,其中用来存储整数的叫做整数型数据类型,下列不是整数型数据类型的是()
A.bigint
B.int
C.smallint
D.char
正确答案:char
5、在下面职工信息表和部门信息表中,职工号和部门号分别是主关键字。职工表(职工号、职工名、部门号、职务、工资)部门表(部门号、部门名、部门人数据、工资总数)在这两个表中,只有一个外关键字,是()
A.职工信息表的“职工号”
B.职工信息表的“部门号”
C.部门表的“部门号”
D.部门表的“部门名”
正确答案:职工信息表的“部门号”
6、选择要执行操作的数据库,应该使用()命令
A.GO
B.USE
C.EXEC
D.SP()EXEC
正确答案:USE
7、目前()数据库已经逐步淘汰了网状数据库和层次数据库,成为当今最为流行的商用数据库系统
A.关系
B.面向对象
C.分布
D.sql
正确答案:关系
8、长期存储在计算机内的有组织,可共享的数据集合是()
A.数据库管理系统
B.数据库系统
C.数据库
D.文件组织
正确答案:数据库
9、数据库系统不仅包括数据库本身,还要包括相应的硬件,软件和()
A.数据库管理系统
B.数据库应用系统
C.相关的计算机系统
D.各类相关人员
正确答案:各类相关人员
10、SQL Server的字符型系统数据类型主要包括()
A.int、money、char
B.char、varchar、text
C.datetime、binary、int
D.varchar、int、char
正确答案:char、varchar、text
11、创建数据库的语法命令是()
A.create table
B.create database
C.create view
D.create datebase
正确答案:create database
12、新建一个查询分析器窗口,首先打开的是一个默认的()数据库
A.tempt
B.master
C.当前操作的数据库
D.studentmanager
正确答案:master
第二章单元测试
1、不允许在数据表中弹出重复列值的约束是通过()来实现的
A.Check
B.Default
C.Foreign Dey
D.Primary Key或Unique
正确答案:Primary Key或Unique
2、从student表中删除一列address的命令是()
A.alter table student drop column address
B.alter table student remove column address
C.drop column address from student
D.delete address from student
正确答案:drop column address from student
3、在数据表中更新数据的命令是()
A.select
B.insert into
C.update…set
D.delete
正确答案:update…set
4、要删除数据表中满足某条件的记录的命令是()
A.delete
B.delete...from...
C.delete from...
D.delete from...where...
正确答案:delete from...where...
5、向student数据表中添加部分记录的命令是()
A.insert into
B.insert into student values()
C.insert into student() values()
D.insert into student ...values...
正确答案:insert into student() values()
6、向student数据表中添加全部记录的命令是()
A.insert into
B.insert into student
C.nsert into student values()
D.nsert into student() values()
正确答案:nsert into student values()
7、向student表中添加某一列address的命令是()
A.alter table student add address varchar(50)
B.add address varchar(50)
C.insert into address varchar(50)
D.insert into student address varchar(50)
正确答案:alter table student add address varchar(50)
8、将student表中的列address的数据类型中的字节大小改为varchar(50),使用的语句命令是()
A.update student set
B.add address varchar(50)
C.alter table student alter address varchar(50)
D.alter address varchar(50)
正确答案:alter table student alter address varchar(50)
9、创建数据表的语法命令是()
A.create table
B.create database
C.create view
D.creat table
正确答案:create table
10、更新student数据表中address列的数据类型中字节长度为varchar(50)
A.alter table student drop column address
B.alter table student alter address varchar(50)
C.drop column address from student
D.delete address from student
正确答案:alter table student alter address varchar(50)
11、修改student表中学号为2015001的学生的姓名为“张三”
A.update student set sname=’ 张三’ where sid=’2015001’
B.update student set sname=张三 where sid=’2015001’
C.update student set sname=”张三” where sid=’2015001’
D.alter table student alter sname=’ 张三’ where sid=’2015001
正确答案:update student set sname=’ 张三’ where sid=’2015001’
12、向学生表student中插入记录:学号(sid)、姓名(sname)、所在系(depart),值为(‘2016001‘,’张红‘,’管理系‘)
A.insert into student(sid,sname,depart) values(‘2016001’,’张红’,’管理系’)
B.insert into student values(‘2016001’,’张红’,’管理系’)
C.insert into student (sid,sname,depart) values("2016001","张红","管理系")
D.insert into student(sid,sname,depart) values(‘2016001’,’张红’,’管理系’,‘计应’)
正确答案:insert into student(sid,sname,depart) values(‘2016001’,’张红’,’管理系’)
第三章单元测试
1、查询年龄在20到23岁之间的学生的信息,所使用的语法命令为()
A.select * from student where age between 20 to 23
B.select * from student where age between 20 and 23
C.select * from student where age from 20 to 23
D.select * from student
正确答案:select * from student where age between 20 and 23
2、查询年龄不在20到23岁之间的学生的信息,所使用的语法命令为()
A.select * from student where age not between 20 and 23
B.select * from student where age not between 20 to 23
C.select * from student where not age from 20 to 23
D.select * from student where age between 20 and 23
正确答案:select * from student where age not between 20 and 23
3、查询信息技术系,机电工程系和管理系的学生的信息,所使用的语法命令()
A.select * from student where depart=’ 信息技术系’ and depart=’ 机电工程系’ and depart=’ 管理系’
B.select * from student where depart=”信息技术系”and depart=”机电工程系”and depart=”管理系”
C.select * from student where depart in(’信息技术系’,’机电工程系’,’管理系’)
D.select * from student where depart in(”信息技术系”,”机电工程系”,”管理系”)
正确答案:select * from student where depart in(’信息技术系’,’机电工程系’,’管理系’)
4、查询不在信息技术系,机电工程系和管理系的学生的信息,所使用的语法命令为()
A.select * from student where not depart=’ 信息技术系’ and depart=’ 机电工程系’ and depart=’ 管理系’
B.select * from student where depart not in(’信息技术系’,’机电工程系’,’管理系’)
C.select * from student where not depart=”信息技术系”and depart=”机电工程系”and depart=”管理系”
D.select * from student where not depart in(”信息技术系”,”机电工程系”,”管理系”)
正确答案:select * from student where depart not in(’信息技术系’,’机电工程系’,’管理系’)
5、查询成绩为空值的学生的信息,语法命令为()
A.select * from sc where grade=null
B.select * from sc where grade is null
C.select * from sc where grade is ‘’
D.select * from sc where grade=’’
正确答案:select * from sc where grade is null
6、查询成绩不为空值的学生的信息,语法命令为()
A.select * from sc where grade is not null
B.select * from sc where grade!=null
C.select * from sc where grade is not ‘’
D.select * from sc where grade!=’’
正确答案:select * from sc where grade is not null
7、查询信息技术系年龄在20到23岁之间的学生的信息,所使用的语法命令为()
A.select * from student where age between 20 to 23 and depart=’信息技术系’
B.select * from student where age from 20 to 23 and depart=’信息技术系’
C.select * from student where depart=’信息技术系’ and age between 20 to 23
D.select * from student where age between 20 and 23 and depart=’信息技术系’
正确答案:select * from student where age between 20 and 23 and depart=’信息技术系’
8、统计信息技术系学生总人数,所使用的语法命令为()
A.select *from student
B.select count(*) from student
C.select count(*) from student where depart=’信息技术系’
D.select count(*) from student where depart is’信息技术系’
正确答案:select count(*) from student where depart=’信息技术系’
9、查询选修了a001号课程且成绩在60分以上的所有学生
A.select * from student where cid=’a001’ and grade>=60
B.select * from course where cid=’a001’ and grade>=60
C.select * from sc where cid=’a001’ and grade>=60
D.select * from sc where cid=’a001’
正确答案:select * from sc where cid=’a001’ and grade>=60
10、下面()语句用于对查询结果进行分组
A.computer by
B.order by
C.group by
D.having
正确答案:group by
11、属于不属于聚合函数的是()
A.AVG()
B.MAX()
C.COUNT ()
D.CONTAINSTABLE ()
正确答案:CONTAINSTABLE ()
12、按课程号分类,统计相应的选课人数()
A.select cid, count(*) from student group by cid
B.select cid, count(distinct sid) from sc group by cid
C.select cid, count(distinct sid) from student group by cid
D.select cid, count(distinct cid) from sc group by cid
正确答案:select cid, count(distinct sid) from sc group by cid
13、查询选修了2门课程以上的学生学号()
A.select sid,count(*) from sc group by sid where count(*)>=2
B.select sid,count(*) from sc where count(*)>=2 group by sid
C.select sid,count(*) from sc group by sid having count(*)>=2
D.select sid,count(*) from sc group by cid having count(*)>=2
正确答案:select sid,count(*) from sc group by sid having count(*)>=2
14、用于计算平均值的聚合函数是()
A.AVG ()
B.MAX()
C.COUNT()
D.CONTAINSTABLE()
正确答案:AVG ()
15、按照学号进行分组,统计学生的平均成绩()
A.select sid, avg(grade) from student group by sid
B.select sid, avg(grade) from sc group by sid
C.select sid, avg(grade) from student group by cid
D.select sid, avg(grade) from sc group by cid
正确答案:select sid, avg(grade) from sc group by sid
16、用于统计最高值的聚合函数是()
A.AVG()
B.MAX ()
C.COUNT()
D.CONTAINSTABLE()
正确答案:MAX ()
17、查询选修了a001号课程的学生的最高成绩()
A.select cid,max(grade) from student where cid=’a001’ group by cid
B.select cid, max(grade) from student group by cid having cid=’a001’
C.select cid, max(grade) from sc where cid=’a001’ group by cid
D.select cid, max(grade) from course where cid=’a001’ group by cid
正确答案:select cid, max(grade) from sc where cid=’a001’ group by cid
18、用于统计最低值的聚合函数是()
A.AVG ()
B.MAX()
C.COUNT ()
D.MIN()
正确答案:MIN()
19、统计选修了a001课程的学生的平均成绩()
A.select cid,avg(grade) from student where cid=’a001’ group by cid
B.select cid,avg(grade) from student group by cid having cid=’a001’
C.select cid,avg(grade) from sc where cid=’a001’ group by cid
D.select cid,avg(grade) from course where cid=’a001’ group by cid
正确答案:select cid,avg(grade) from sc where cid=’a001’ group by cid
20、按照课程号进行分组,统计学生平均成绩大于60分的学生的信息()
A.select cid,avg(grade) from student where avg(grade)>60 group by cid
B.select cid,avg(grade) from student group by cid having avg(grade)>60
C.select cid,avg(grade) from course where avg(grade)>60 group by cid
D.select cid,avg(grade) from sc group by cid having avg(grade)>60
正确答案:select cid,avg(grade) from sc group by cid having avg(grade)>60
21、下面()语句用于对查询结果进行排序
A.Computer by
B.Order by
C.Group by
D.having
正确答案:Order by
22、查询全体学生的情况,查询结果按所在系升序排列,同一系中的学生按年龄的降序排列()
A.select * from student order by depart,age desc
B.select * from student order by depart and age desc
C.select * from sc order by depart,age desc
D.select * from sc order by depart and age desc
正确答案:select * from student order by depart,age desc
23、按照学号进行分组,统计学生的平均成绩,且平均分按降序排列
A.select sid, avg(grade) from sc group by sid order by avg(grade) desc
B.select sid, avg(grade) from student group by sid order by avg(grade) desc
C.select sid, avg(grade) from student group by cid order by avg(grade)
D.select sid, avg(grade) from sc group by cid order by avg(grade) desc
正确答案:select sid, avg(grade) from sc group by sid order by avg(grade) desc
24、查询姓“李”的学生的所有信息
A.select * from student where sname like ‘%李%
B.select * from student where sname like “%李%”
C.select * from student where sname like ‘#李%’
D.select * from student where sname like ‘%李#’
正确答案:select * from student where sname like ‘%李%
25、查询学生的学号,姓名,选修课程号和课程成绩
A.select sid,sname,cid,cname from student,course
B.select sid,sname,cid,cname from student,sc
C.select sid,sname,cid,grade from student,sc where student.sid=sc.sid
D.select * from student,sc where student.sid=sc.sid
正确答案:select sid,sname,cid,grade from student,sc where student.sid=sc.sid
26、查询成绩在60分以上的学生的信息及其选课的课程号和成绩
A.select * from student,course where grade>=60
B.select student.*,cid,grade from student,sc where student.sid=sc.sid and grade>=60
C.select * from student,sc where student.sid=sc.sid where grade>=60
D.select * from student,sc where student.sid=sc.sid where student.sid=sc.sid
正确答案:select student.*,cid,grade from student,sc where student.sid=sc.sid and grade>=60
27、查询学生的学号,姓名,系,专业,所选课程的课程号、课程名和成绩
A.select * from student,course,sc where sudent.sid=sc.sid and course.cid=sc.sid
B.select sid,sname,depart,zhuanye,cid,cname,grade from student,course,sc where student.sid=sc.sid and course.cid=sc.sid
C.select student.sid,sname,depart,zhuanye,cid,cname,gradefrom student,course,sc where student.sid=sc.sid and course.cid=sc.sid
D.select student.sid,sname,depart,zhuanye,course.cid,cname,gradefrom student,course,sc where student.sid=sc.sid and course.cid=sc.sid
正确答案:select student.sid,sname,depart,zhuanye,course.cid,cname,gradefrom student,course,sc where student.sid=sc.sid and course.cid=sc.sid
28、查询选修了a001课程的学生的学号,姓名,系,专业,所选课程的课程号、课程名和成绩
A.select * from student,course,sc where sudent.sid=sc.sid and course.cid=sc.sid and cid=‘a001’
B.select sid,sname,depart,zhuanye,cid,cname,grade from student,course,sc where student.sid=sc.sid and course.cid=sc.sid and cid=a001
C.select student.sid,sname,depart,zhuanye,cid,cname,grade from student,course,sc where student.sid=sc.sid and course.cid=sc.sid and cid=‘a001’
D.select student.sid,sname,depart,zhuanye,course.cid,cname,grade from student,course,sc where student.sid=sc.sid and course.cid=sc.sid and cid=‘a001’
正确答案:select student.sid,sname,depart,zhuanye,course.cid,cname,grade from student,course,sc where student.sid=sc.sid and course.cid=sc.sid and cid=‘a001’
第四章单元测试
1、下面语句()是正确的
A.视图是一种常用的数据库对象,使用视图不能简化数据操作
B.使用视图可以提高数据库的安全性
C.删除视图时同时删除了基本表
D.视图和表一样是由数据构成的
正确答案:使用视图可以提高数据库的安全性
2、下面()语句是用来创建视图的。
A.create view as
B.create table
C.alter view
D.alter table
正确答案:create view as
3、下面()语句是用来修改已经创建好的视图的
A.create view
B.update…set…
C.alter view
D.alter table
正确答案:alter view
4、创建存储过程的命令是()
A.create view
B.create procedure
C.alter procedure
D.alter view
正确答案:create procedure
5、修改已经创建好的存储过程的命令是()
A.create view
B.create procedure
C.alter procedure
D.alter view
正确答案:alter procedure
6、下面()命令可以查看存储过程的文本信息
A.sp()helptext
B.sp()opentext
C.sp()rename
D.sp()readingprocedure
正确答案:sp()helptext
7、保护数据库,防止未经授权或不合法的使用造成的数据泄露、非法更改或破坏,这是指数据的()
A.安全性
B.完整性
C.并发控制
D.恢复
正确答案:安全性
第五章单元测试
1、以下所示的文件名后缀中只有()不是静态网页的后缀
A..html
B..shtml
C..htm
D..aspx
正确答案:.aspx
2、下列文件名后缀中,只有()不是动态网页的后缀
A..jsp
B..xml
C..aspx
D..php
正确答案:.xml
3、下列选项中,只有()是错误的
A.asp.net提供了多种语言支持
B.asp.net提供了多种平台支持
C.asp.net提供了跨平台支持,也可以在Unix平台下执行
D.asp.net采取编译执行的方式,极大地提高了运行的性能
正确答案:asp.net提供了跨平台支持,也可以在Unix平台下执行
4、在ADO.NET数据处理流程中,用于连接数据库的类是哪个()
A.SqlConnection
B.SqlCommand
C.SqlDataReader
D.DataSet
正确答案:SqlConnection
5、在ADO.NET数据处理流程的第一种模式中,用于对数据库进行操作的类是哪个()
A.SqlConnection
B.SqlCommand
C.SqlDataReader
D.DataSet
正确答案:SqlCommand
6、在ADO.NET数据处理流程的第一种模式中,用于读取数据的类是哪个()
A.SqlConnection
B.SqlCommand
C.SqlDataReader
D.DataSet
正确答案:SqlDataReader
7、在ADO.NET数据处理流程的第二种模式中,用于获取数据的类是哪个()
A.SqlDataReader
B.SqlDataAdapter
C.DataSet
D.SqlCommand
正确答案:SqlDataAdapter
8、使用SqlDataAdapter获取到数据后,使用哪个类来存放数据()
A.SqlConnection
B.SqlCommand
C.SqlDataReader
D.DataSet
正确答案:DataSet
9、使用SqlDataAdapter获取到数据后,要使用()方法将数据填充到缓冲区中
A.Write()
B.Fill()
C.Redirect()
D.alert()
正确答案:Fill()
10、SqlCommand类的对象有三种方法,下面哪种不是()
A.ExecuteReader()
B.ExecuteNonQuery()
C.Redirect()
D.ExecuteScalar()
正确答案:ExecuteReader()
11、在数据处理中,如果要将数据表中的数据绑定在页面,需要使用SqlCommand类的对象的哪种方法()
A.ExecuteNonQuery()
B.ExecuteReader()
C.Redirect()
D.ExecuteScalar()
正确答案:ExecuteReader()
12、在数据处理中,如果要实现将数据表中的数据进行添加与删除的操作,需要使用SqlCommand类的对象的哪种方法()
A.ExecuteReader()
B.Redirect()
C.ExecuteNonQuery()
D.ExecuteScalar()
正确答案:ExecuteNonQuery()
13、在数据处理中,如果要将数据表中的数据进行统计的操作,需要使用SqlCommand类的对象的哪种方法()
A.ExecuteReader()
B.ExecuteNonQuery()
C.Redirect()
D.ExecuteScalar()
正确答案:ExecuteScalar()
14、在ADO.NET数据处理流程模式中,要连接数据库必须先创建连接字符串,下面()是连接字符串
A.SqlConnection
B.ConnectionString
C.SqlConnectionString
D.DataSet
正确答案:ConnectionString