若用表Reader存储读者信息,Book表存储图书信息,Borrow表存储借阅情况。
以下SQL语句是“查询证号为12345的读者当前所借阅的图书书名(即尚未归还的图书)”,请补充完整。
SELECT 书名 FROM Book WHERE 流水号 (1)
(SELECT流水号FROM (2) WHERE 证号="12345" AND (3)
以下SQL语句是“查询书名包含‘软件设计师’的图书情况”,请补充完整。
SELECT * FROM Book WHERE书名 (4) "%软件设计师%"
阅读以下说明和Java代码,回答问题
[说明]
对多个元素的聚合进行遍历访问时,需要依次推移元素,例如对数组通过递增下标的方式,数组下标功能抽象化、一般化的结果就称为迭代器(Iterator)。模式以下程序模拟将书籍(Book)放到书架(BookShelf)上并依次输出书名。这样就要涉及到遍历整个书架的过程。使用迭代器Iterator实现。图6-1显示了各个类间的关系。以下是JAVA语言实现,能够正确编译通过。
[图6-1]
[Java代码]
//Iterator. java文件
public interface Iterator {
public abstract boolean hasNext();
public abstract Object next();
}
//Aggregate. java文件
public interface Aggregate {
public abstract Iterator iterator();
}
//Book. java
public class Book {
//省略具体方法和属性
}
//BookshelfIterator. java文件
public class Bookshelf工terator (1) Iterator{
private BookShelf bookShelf;
private int index;
public BookshelfIterator(BookShelf bookShelf) {
this. bookShelf = bookShelf;
this. index = 0;
}
public boolean hasNext(){//判断是否还有下一个元素
if(index< bookShelf. getLength()){
return true;
}else{
return false;
}
}
public Object next()f//取得下一个元素
Book book = bookShelf. getBookAt(index);
index++;
return book;
}
}
//BookShelf. java
import java. util. Vector;
public class BookShelf {
private Vector books;
public BookShelf(int initialsize){
this. books = new Vector(initialsize);
}
public Book getBookAt(int index){
return(Book)books.get(index);
}
public int getLength(){
return books.size();
}
public Iterator iterator(){
return new BookShelfIterator( (2) );
}
}
//Main. java文件
public class Main {
public static void main(String args){
BookShelf bookShelf = new BookShelf(4);
//将书籍上架,省略代码
Iterator it = bookShelf. (3) ;
while( (4) ){//遍历书架,输出书名
Book book = (Book)it. (5) ;
System.out.printin(" "+book.getName());
}
}
}
阅读下列函数说明和C++代码,回答问题
[说明]
对多个元素的聚合进行遍历访问时,需要依次推移元素,例如对数组通过递增下标的方式,数组下标功能抽象化、一般化的结果就称为迭代器(Iterator)。模式以下程序模拟将书籍(Book)放到书架(BookShelf)上并依次输出书名。这样就要涉及到遍历整个书架的过程。使用迭代器Iterator实现。图5-1显示了各个类间的关系。以下是C++语言实现,能够正确编译通过。
[图5-1]
[C++代码]
template (1) >
class Iterator{
public:
virtual bool hasNext() = 0;
(2) Object* next() = 0;
};
class Book{
//省略具体方法和属性
};
class BookShelf{
private:
vector books;
public:
BookShelf(){
}
Book* getBookAt(int index){
return &booksindex;
}
int getLength(){
return books. size();
}
};
template
class BookshelfIterator : public (3) {
private:
BookShelf * bookShelf;
int index;
public:
BookshelfIterator(BookShelf *bookShelf){
this->bookShelf = bookShelf;
index = 0;
}
bool hasNext(){//判断是否还有下一个元素
if(index< bookShelf->getLength()){
return true;
}else{
return false;
}
}
Objeot* next(){//取得下一个元素
return bookShelf->getBookAt(index++);
}
};
int main()
{
BookShelf bookShelf;
//将书籍上架,省略代码
Book *book;
Iterator *it = new BookShelfIterator( (4) );
while( (5) ){//遍历书架,输出书名
book=(Book*)it->next();
/*访问元素*/
}
return 0;
}
阅读以下函数说明和C代码,回答问题
[说明]
对多个元素的聚合进行遍历访问时,需要依次推移元素,例如对数组通过递增下标的方式,数组下标功能抽象化、一般化的结果就称为迭代器(Iterator)。模式以下程序模拟将书籍(Book)放到书架(BookShelf)上并依次输出书名。这样就要涉及到遍历整个书架的过程。使用迭代器Iterator实现。图7-1显示了各个类间的关系。以下是JAVA语言实现,能够正确编译通过。
[图7-1]
[C代码]
typedef bool(*fun1)();
typedef (1) (*fun2)();
const int BOOK_MAX = 10;//最大书本数
struct Book{
char name30;
};
struct BookShelf{//书架
struct Book books[BOOK MAX];
int index;//书架上最后一本书的下标加1,即下一本书的下标,如0表示有0本书
};
Struct Book* getBookAt(struct BookShelf *BS, int index)
//从书架BS上取得下标为index的书
//只有当下标大于等于0且不大于当前书架上的最后一本书对应的下标,才取书成功:
//否则失败,返回NULL
{
if(index >= 0 && (2) ){
return &BS->books[index];
}
return NULL;
}
bool appendBook(struct BookShelf *BS, struct Book book)
{
if(BS->index< BOOK_MAX){
BS->books[BS->index++] = book;
return true;
}
return false;
}
int getLength(struct BookShelf *bookShelf)
{
return bookShelf->index;
}
struct Iterator{//迭代器
fun1 hasNext;//判断是否还有下一个元素
fun2 next;//取得下一个元素
};
struct BookshelfIteratorf{//书架迭代器
int index;
struet BookShelf* bookShelf;
}bookShelfIterator = {0, NULL};
bool BShasNext()//判断是否还有下一本书
{
if(bookShelfIterator.index
return true;
}else{
return false;
}
}
struct Book* BSnext()//取得下一本书,并将index加1,以便下一次正确访问
{
return getBookAt(bookShelfIterator.bookShelf,
(3) );
}
void main()
{
struct BookShelf bookShelf;
bookShelf.index = 0;
//将书籍上架,省略代码
//将bookShelf与bookShelfIterator相关联
bookShelfIterator.bookShelf = (4) ;
struct Iterator iterator;
iterator.hasNext = BShasNext;
iterator.next = BSnext;
struct Book* b;
while( (5) ){//遍历书架,输出书名
b=iterator.next();
printf("%s\n", b->name);
}
}
[说明]
本流程图描述了某子程序的处理流程,现要求用白盒测试法对其进行测试。
根据判定覆盖、条件覆盖、判定/条件覆盖、多重条件覆盖(条件组合覆盖)、路径覆盖5种覆盖标准,从供选择的答案中分别找出满足相应覆盖标准的最小的测试数据组(用①~⑩回答)。供选择的答案:
[函数]
void Del(POLY *C, struct Node *p)
/*若p是空指针则删除头节点,否则删除p节点的后继*/
{
struct Node *t;
/*C是空指针或C没有节点*/
if(C == NULL || C->head == NULL)return;
if( (1) )(/*删除头节点*/
t = C->head;
C->head = t->next;
return;
}/*if*/
t = p->next;
p->next = t->next;
};/*Del*/
void Insert(POLY *C, struet Node *pC)
/*将pC节点按指数降序插入到多项式C中*/
/*若C中存在pC对应的指数项,则将系数相加;若其结果为零,则删除该节点*/
{
struct Node *t, *tp;
/*pC为空指针或其系数近似为零*/
if(pC == NULL || fabs(pC->c)< EPSI)return;
if(C->head == NULL){ /*若C为空,作为头节点插入*/
C->head = pC;
pC->next = NULL;
C->n++;
return;
}/*if*/
/*若pC的指数比头节点的还大,插入到头节点之前*/
if(pC->e >C->head-)e){
(2) ;
C->head = pC;
C->n++;
return;
}/*if*/
(3) ;
t = C->head;
while(t!= NULL){
if(t->e >pC->e){
tp = t;
t = t->next;
}
else if(t->e == pC->e){ /*C中已经存在该幂次项*/
t->c += pC->c; /*系数相加*/
if(fabs(t->c)< EPSI){ /*系数之和为零*/
(4) ; /*删除对应节点*/
C->n--;
}
(5) ;
}
else t = NULL; /*C中已经不存在该幂次项*/
}/*while*/
if(t == NULL){/*适当位置插入*/
pC->next = tp->next;
tp->next = pC;
C->n++;
}/*if*/
};/*Insert*/
若用表Reader存储读者信息,Book表存储图书信息,Borrow表存储借阅情况。
以下SQL语句是“查询证号为12345的读者当前所借阅的图书书名(即尚未归还的图书)”,请补充完整。
SELECT 书名 FROM Book WHERE 流水号 (1)
(SELECT流水号FROM (2) WHERE 证号="12345" AND (3)
以下SQL语句是“查询书名包含‘软件设计师’的图书情况”,请补充完整。
SELECT * FROM Book WHERE书名 (4) "%软件设计师%"
由于同一个分类目录号(同一种图书)有多个副本,若用表Book(图书流水号,分类目录号,书名,作者,内容摘要,价格,购书日期)存储图书信息则有很多的冗余信息,该如何分解使之满足BCNF,并指出分解后的关系模式的主键。
根据题中所述术语,指出图1-2中状态1到状态4分别是什么?
实体间的联系有“一对一”、“一对多”和“多对多”,指出“借阅”联系属于哪一种?“借阅”关系模式的外键是什么?有主键吗?为什么?
根据题意,给出“地铁票”类的主要属性。
高级经济师考试试题精选练习(1)
高级经济师考试模拟练习题之单选题(1
高级经济师考试试题精选练习(2)
高级经济师考试试题精选练习(3)
高级经济师考试试题:经济法案例试题精
高级经济师考试模拟试题及答案
高级经济师考试试题及答案:单选练习题
高级经济师考试试题:经济法案例试题精
高级经济师考试模拟题及答案练习(1)
高级经济师考试模拟题及答案练习(2)