2. The extension name of a Java bytecode file is _______.A. .java B. .obj C. .class D. .exe
第1题:
YoucreateaWebpagethatcontainsthefollowingcode.Youneedtoprovidethefollowingimplementation.EachtimetheAddFilebuttonisclicked,anewdivelementiscreated.ThenewdivelementisappendedaftertheotherfileuploaddivelementsandbeforetheAddFilespan.Eachnewelementhasauniqueidentifier.Whichcodesegmentshouldyouuse?()
A.$("#AddFile").click(function(){varid="File"+++lastId;varitem=$(".File:first").clone(true);$("input:file",item).attr({id:id,name:id});item.insertBefore("#AddFile");});
B.$("#AddFile").click(function(){varid="File"+++lastId;$(".File:first").clone(true).attr({id:id,name:id}).insertBefore("#AddFile");});
C.$("#AddFile").click(function(){varid="File"+++lastId;});
D.$("#AddFile").click(function(){varid="File"+++lastId;varitem=$(".File:first").clone(true);$("input:file",item).attr({id:id,name:id});item.insertAfter("input[type=file]");});
第2题:
阅读下列说明和c++代码,将应填入 (n) 处的字句写在答题纸的对应栏内。
【说明】
现欲构造一文件/目录树,采用组合(Composite)设计模式来设计,得到的类图如6—7所示:
【c++代码】
include<1ist>
include
include
using namespace std;
class AbstractFile{
protected:
string name;//文件或目录名称
public:
void printName(){cout<*getChildren()=0; //获得一个目录的子目录或文件
};
class File:public AbstractFile{
public:
File(string name){ (1) =name;)
void addChild(AbstractFile*file){return ;)
void removeChiid(AbstractFile*file){return;}(2) getChildren(){return ( 3 ) ;}
};
class Folder:public AbstractFile{
private:
listchildList; //存储子目录或文件
public:
Folder(string name){ (4) =name;}
void addChild(AbstractFile*file){childList.push back(file);}
void removeChiid(AbstractFile*file)(chiidList.remove(file);}
list*getChildren(){return (5) ;)
};
voidmain(){
//构造一个树形的文件/目录结构
AbstractFile*rootFolder=new Folder(“C:\\”);
AbstractFile*compositeFolder=flew Folder(”composite”);
AbstractFile*windowsFolder=new Folder(”windows”);
AbstractFile*file=new File(”TestComposite.java”);
rootFolder->addChild(compositeFolder);
rootFolder->addChild (windowsFolder);
compositeFolder->addChiid(file);
)
第3题:
【Java代码】
import Java.util.ArrayList;
import java.util.List;
(1) class AbstractFile{
protected String name;
public void printName(){System.out.println(name);}
public abstract boolean addChild(AbstractFile file);
public abstract boolean removeChild(AbstractF ile file);
public abstract List<AbstractFile> getChildren();
}
class File extends AbstractFile{
public File(String name){this.name=name;}
public boolean addChild(AbstractFile file){return false;}
public boolean removeChild(AbstractFile file){return false;}
public List<AbstractFile> getChildren(){return (2) ;}
}
class Folder extends AbstractFile{
private List <AbslractFile> childList;
public Folder(String name){
this.name=name;
this.childList=new ArrayList<AbstractFile>();
}
public boolean addChild(AbstractFile file) { return childList.add(file);}
public boolean removeChild(AbstractFile file){return childList.remove(file);}
public (3) <AbstractFile> getChildren(){return (4) ;}
}
public class Client{
public static void main(String[] args){
//构造一个树形的文件/目录结构
AbstractFile rootFolder= new Folder("c:\\ ");
AbstractFile compositeFolder=new Folder("composite");
AbstractFile windowsFolder=new Folder("windows");
AbstractFile file=new File("TestComposite.java");
rootFolder.addChild(compositeFolder) ;
rootFolder.addChild(windowsFolder);
compositeFolder.addChild(file) ;
//打印目录文件树
printTree(rootFolder);
}
private static void printTree(AbslractFile ifile){
ifile.printName();
List <AbslractFile> children=ifile.getChildreno:
if(children==null) return;
for (AbstractFile file:children) {
(5) ;
}
}
}
该程序运行后输出结果为:
c:\
composite
TestComposite.java
Windows
第4题:
下列语句正确的有()
第5题:
下列程序中,要求输出一个特定文件(这里是ex2_1.java)的相关信息,包括文件的名字,相对路径以及文件的长度。请将程序补充完整。
程序运行结果如下:
name:ex2_1.java
path:ex2_1.java
length: 299
import java.io.*;
public class ex2_1{
public static void main(String[] args) {
File file2_1 = new File("ex2_1.java");
System.out.println("name:"+file2_1.____________ );
System.out.println("path:"+file2_1.____________ );
System.out.println("length:"+file2_1.____________ );
}
}
第6题:
A.log_file_name_convert
B.convert_log_file_name
C.file_name_convert_log
D.redo_log_file_name_convert
E.logfile_convert_directory
第7题:
阅读下列说明和Java代码,将应填入 (n) 处的字句写在答题纸的对应栏内。
【说明】
现欲构造一文件/目录树,采用组合(Composite)设计模式来设计,得到的类图如6—8所示:
【Java代码】
import JavA.util.ArrayList;
import JavA.util.List;(1)class AbstractFile{
protected String name;
public void printName(){System.out.println(name);}
public abstract boolean addChild(AbstractFile file);
public abstract boolean removeChild(AbstractFile file);
public abstract ListgetChildren {};
}
class File extends AbstractFile{
public File(String name)(this.name=name;}
public boolean addChild(AbstractFile file){return false;}
public boolean removeChild(AbstractFile file){return false;}
public ListgetChildren(){return (2) ;)
}
clasS Folder extends AbstractFile{
private ListchildList;
public Folder(String name){
thiS.name=name;
this.childList=new ArrayList{};
}
public boolean addChild(AbstractFile file){return childList.add(file);}
public boolean removeChild(AbstractFile file){return childList.remove(file);
public (3)getChildren(){return (4) ;)
}
public class Client{
public static void main(String[]args){
//构造一个树形的文件/目录结构
AbstractFile rootFolder=new Folder(“C:\”’);
AbstractFile compositeFolder=new Folder(”composite”);
AbstractFile windowsFolder=new Folder(”windows”);
AbstractFile file=new File(”TestComposite.java”);
rootFOlder.addChild (compositeFolder);
rootFolder.addChiid(windowsFolder);
compositeFolder.addChild(file);
//打印目录文件树
printTree(rootFolder);
}
private static void printTree(AbstractFile ifile){
ifile.PrIntName();
Listchildren:ifile.getChildren ();
if(chiidren==null)return;
for(AbstractFile file:children){(5) ;
}
}
}
该程序运行后输出结果为:
C:\
composite
TestComposite.java
Windows
第8题:
下列程序中,要求输出一个特定文件(这里是ex1.java)的相关信息,包括文件的名字,相对路径以及文件的长度。请将程序补充完整。
程序运行结果如下:
name:ex1.java
path:ex1.java
length:299
注意:不改动程序结构,不得增行或删行。
import java.io.*;
public class ex1
{
public static void main(String[] args)
{
File filel=new File("ex1.java");
System.out println("name:"+file1.______);
System.out println("path:"+file1.______);
System.out println("length:"+file1.______);
}
}
第9题:
Which file characteristic cannot be used in the Cisco IronPort Data Security policies?()
第10题:
public class test { public static void main(String [] a) { assert a.length == 1; } } Which two will produce an AssertionError?()