为了正常的体验网站,请在浏览器设置里面开启Javascript功能!
首页 > java期末100选择题

java期末100选择题

2011-01-08 18页 doc 246KB 50阅读

用户头像

is_895531

暂无简介

举报
java期末100选择题Why was the Java programming language created 1. What is Java? Why was the Java programming language created? A. Java was created to produce applications for the Internet. B. Java was created to produce applications for large corporations. *C. Java was created to pr...
java期末100选择题
Why was the Java programming language created 1. What is Java? Why was the Java programming language created? A. Java was created to produce applications for the Internet. B. Java was created to produce applications for large corporations. *C. Java was created to produce applications for small appliances. D. Java was created to produce applications for personal computers. Which of the following programming paradigms allows a programmer to develop software based on entities that simulate real world concepts? A. Event Driven Programming B. Functional Programming *C. Object Oriented Programming D. Procedural Programming Which one of the following Java keywords is required when declaring the main method that is the start of a Java application? *A. static B. class C. final D. int Which of the following is used to create the file containing the Java instructions? A. word processor B. compiler editor C. source editor *D. text editor Which of the following is true of the Java programming language? A. Code may exist in multiple programs requiring multiple updates. B. Code requires a great deal of maintenance work from the programmer. C. Code is written in linear fashion to solve the problem. *D. Code is written in small manageable pieces Which of the following could possibly cause a runtime error? A. misspelled keyword B. missing semicolon *C. divide by zero D. incorrect class modifier Which of the following provides the correct definition of an application? A. Computer programs that provide the basic operations of the computer (track mouse movements, display text to the screen, etc.). *B. Computer programs that accept data and produce useful information. C. Only computer programs that were purchased from a software company. D. Only computer programs that were written by the user. Where can you find the BlueJ IDE? *A. http://www.bluej.org B. http://www.bluej.com C. http://www.java.sun/bluej D. http://www.bluej.java.sun What must all Java applications contain? A. an applet B. a final class *C. a main method D. an applet class Which of the following computer components are referred to as hardware? A. monitor, keyboard, and programs B. mouse, CPU, and programs *C. monitor, CPU, and keyboard D. keyboard, programs, and mouse Which of the following hardware components is considered to be the brain of a computer? *A. CPU B. Hard disk C. RAM D. System Bus Which sequence best describes the physical steps taken to produce a running Java program? A. Write the program. Compile to bytecode. Translate to native code. Run program. B. Write the program. Translate to native code. Compile to bytecode. Run program. *C. Write the program. Compile to bytecode. Run program. D. Write the program. Compile to native code. Run program. Which of the following is an example of a keyword that is used to specify access? A. Public *B. public C. PUbliC D. PUBLIC Which of the following computer components is referred to as a peripheral device? A. CPU B. CD-Rom C. Hard drive *D. Mouse How can you supply data immediately to your program when you invoke it? A. By adding it to the source file. *B. By typing it on the command line. C. By adding it to the object file. D. By typing it immediately after you start the program Which of the following are used to instruct a program to perform mathematical calculations or a test of data? A. keywords B. identifiers C. syntax *D. operators Which of the following memory types is known as volatile memory? A. Floppy disk B. Hard disk *C. RAM D. ROM Which of the following programming paradigms requires a programmer to use a divide and conquer approach to software development? A. Event Driven Programming B. Functional Programming C. Object Oriented Programming *D. Procedural Programming What is the extension of a Java bytecode file? *A. .class B. .cls C. .java D. .jvm What are the tools: javac, appletviewer, javadoc, and jar a part of? A. JVM *B. J2SDK C. JRE D. JBD Which of the following is the machine independent part used in the execution of a Java program? *A. bytecode B. Java compiler C. Web browser D. JVM Why do humans need high-level programming languages? A. Computers are unable to produce or process sound. *B. Computers process everything in binary and all information must be converted to binary. C. Computers can process information in a programming language without converting the information to binary. D. Computers are intuitive and spoken language must be converted to a language that the computer understands. Which of the following programming paradigms do the Java programming language use? A. Common Business Oriented *B. Object Oriented C. Formula Translator D. Low-Level Which of the following JDK utility programs is used to compile a Java source code file into bytecode? A. jar B. java *C. javac D. javadoc Which of the following uses the correct syntax for a main() method that starts a Java application? A. public static void main() B. public void main(String args[]) *C. public static void main(String args[]) D. public static main(String args[]) 2. Object-Oriented Programming Which of the following terms describes the process of hiding information in an object? *A. Encapsulation B. Relationship C. Constructor D. Mutator Which of the following terms refers to a method that is used to retrieve data from an object? A. Attribute *B. Accessor C. Constructor D. Method Which of the following is not a compartment of the Rectangle class symbol? A. Name B. Attribute *C. Instance variables D. Operation or method What does a constructor method do? A. It defines the class. B. It provides information hiding. C. It defines the objects needed for the application. *D. It specifies the data values an object will store upon creation. What is "object think"? A. A term used to describe the methods of an object. *B. A term used to describe how a programmer should approach the problem specifications. C. A term used to describe what an object does when it is executed. D. A term used to describe how a user must think in order to use an object oriented program. What is the name of the method that contains the instructions for cleanup before an object is destroyed? *A. Finalizer B. Mutator C. Inheritance D. Encapsulation What is a class? A. a specific instance of an object B. an object identifier C. an object reference *D. a blueprint or specification of an object What is the name of the Java library of classes? *A. API B. JVM C. ARI D. JRE Which of the following words is a keyword from the Java language? A. dimension B. subroutine C. header *D. private What is the best group of methods for a bank savings account object? A. balance, interest rate, account number *B. get balance, add interest, set balance, get account number, set account number C. get balance, get account number, get customer address, get interest D. customer name, customer address, balance, account number What can be represented as an object? A. Only items that can be touched are objects. B. Everything that has physical characteristics is an object. *C. Almost anything can be considered an object. D. Items that can be quantified, measured, or weighed are objects. What does a method signature not provide? A. Name B. Data required *C. Object type D. Result type What is the name of the uniform system of symbols and terms used to communicate the design of classes and applications? A. HTM B. XML *C. UML D. VML What is another name for an object identifier? A. Object inheritance B. Object class operations C. Object relationship *D. Object reference Task related objects do not contain which of the following items? A. Documents objects *B. Client objects C. Multimedia objects D. Problem domain objects When programmers use "public String getName()", what are they calling the objects method getName to do? A. Go to the object String to retrieve data *B. Go to the object Name to retrieve data C. Go to the object Get to retrieve data D. Go to the object Public to retrieve data When using containment and inheritance, what are two ways that objects can be related? A. They can share attributes under certain conditions and they can share identifiers. *B. One object may know about another object and one object may be part of another object. C. Two objects may be created in the same program and two objects may be created by the same class. D. Objects may be part of the same directory tree and objects may be stored in the same portion of memory. Which keyword is used to request that an object be created? A. create B. instantiate *C. new D. construct What are mutators and constructors called in object speak? A. Methods B. Data C. Encapsulation *D. Accessors Which of the following choices is an instance of a class Cycle? *A. MountainBike B. FordMustang C. DodgeCaravan D. ToyotaPickUp Which of the following terms refers to a method that accomplishes a non-standard task in a class? A. mutator method B. accessor method C. instance method *D. custom method Which terms are used to describe how an object knows to do things? *A. Behaviors and methods B. Reference and methods C. Operations and behaviors D. Inheritance and behaviors What best describes an accessor? A. An object instance variable used to set the value of an attribute. B. A method that allows you to access a private member of the class. C. A method that will return the type of the object. *D. A method that uses standard ways of retrieving data from an object. The term "object attribute" could be best described by which of the following choices? A. Object attributes are what the "object knows how to do." *B. Object attributes are what the "object knows." C. Object attributes are references to a specific instance of a object. D. Object attributes are the type of the object. When using the Java language, a programmer can accomplish many tasks by what means? A. by writing pages of hexadecimal code to describe the tasks to be performed B. by selecting the tasks from a drop down list *C. by describing objects and defining how the objects will interact D. by defining the interactions of the many lines of code 3. Java Language Elements What is the file extension of a Java source file? A. .class B. .cls *C. .java D. .jvm What does Java use to delineate a block of statements? *A. B. ( ) C. [ ] D. <> What refers to a five faceted storage location in memory that is used to store data? A. Stack *B. Variable C. Heap D. Identifier What is available to all objects and methods while the program is running? A. Stack B. Heap *C. Static storage D. Constant storage Which of the following uses the correct syntax to instantiate a class? A. Point p; B. Point p = Point(); C. Point p = new Point; *D. Point p = new Point(); Which of the following Java commands is used to create documentation in HTML format from a Java source code file? A. jar B. java C. javac *D. javadoc Where does Java store data that is required or referenced by methods? A. registers *B. stack C. heap D. static storage Which of the following choices is dynamic and the second fastest storage space? A. Constant Storage B. Heap C. Static Storage *D. Stack Which of the following terms refers to the usage rules for symbols and keywords of a language? A. grammar B. local *C. syntax D. constant What is the syntax for a multi-line comment in a Java source file? A. \* muli-line comment *\ *B. /* multi-line comment */ C. // multi-line comment // D. \\ multi-line comment \\ Which javadoc comment-line option includes the version information in the generated HTML documentation? A. @v B. @ver C. @vers *D. @version Which of the following statements about the Java keywords is true? A. they are not case-sensitive *B. they can never be used as identifiers C. they can also be used as identifiers D. they can never be used in comments What is the syntax for a single line comment in a Java source file? *A. // B. \\ C. /* */ D. \* *\ What is the scope of a local variable in a method? *A. inside the method that declared the variable B. the entire class that declared the variable C. only classes in the same package as the class that declares the variable D. all classes What is the purpose of including comments in the source code? *A. to communicate with other programmers B. to help the program run C. to make the program more complex D. to help compile the program Which of the following is a special tag that will insert a frame of text? A. /** return description *B. @return description C. \** return description D. * return description All the following are Java keywords except : A. do B. for *C. what D. while What uses memory space in the processor and provides the fastest access to the data? *A. Registers B. Stacks C. Heaps D. Statics Which of the following integral data types can store the largest value? A. byte B. short C. int *D. long Which of the following javadoc special tags is synonymous with the @throws special tag? A. @author *B. @exception C. @param D. @return Which symbols are used to enclose javadoc comments? A. //** and //* B. (** and *) C. \** and \* *D. /** and */ Which of the following choices is a correct identifier? *A. A_Building B. *Building C. 123Building D. A Building What tells the JVM how much memory is required when storing data? A. scope of the data B. value of the data C. life of the data *D. type of the data What does Java use as a separator in a method parameter list? A. : (colon) B. ; (semicolon) *C. , (comma) D. . (period) 4. Java Operators and Control Structures Which of the following is a valid assignment statement? A. bool done = true; *B. boolean done = true; C. bool done = 0; D. boolean done = FALSE; What is the result of the following expression? 11000101 ^ 10011001 A. 11011101 B. 10000001 *C. 01011100 D. 10100011 What will happen if a programmer tries to execute the following code? byte num; num = 1 + 3; A. num will hold the value of 4 B. num will hold the value of 0 C. num will hold the value of 13 *D. the code will not compile because of a type error Which of the following lines of code will produce a compilation error? 1. public int test(String x, int n ) { 2. if ( n == 0) return n 3. else if (n == 1) { 4. if (x !=null ) return 5; 5. } 6. } A. line 1 *B. line 2 C. line 3 D. line 4 The modulus operator is used to obtain which of the following? *A. the remainder in integer division B. a random number in the given number domain C. the quotient in integer division D. the value of the specified bit Which argument type does the System.out.println() method require? A. It can accept any type of argument. *B. It requires a String argument. C. It requires a numeric argument. D. It does not accept any type of argument. What does the '\u' character represent? A. An underline B. The letter u *C. The escape sequence to encode a Unicode character D. A newline What is casting? *A. Converting one object type to another type. B. Deleting the object. C. Accessing the non-private attributes of the object. D. Accessing the private attributes of the object. Why doesn't this expression throw a null pointer exception? Account acct; if(acct != null && acct.balance > 20.0) *A. The AND is short-circuited so the second relational expression is never tested. B. The object acct will hold the default value for a balance. C. The expression will result in a value of true. D. The Account object is created and the constructor will it assign it a value. Which of the following conversions with primitives are allowed? A. primitive to boolean B. boolean to primitive C. primitive to reference *D. double to float Which of the following statements best describes a sequence statement structure? A. The flow of execution can change based on the value of an expression. *B. The flow of execution in a method proceeds from one statement to the statement following it, in the order they appear in the source file. C. Execution of the same set of statements can be performed as many times as the programmer wants. D. Code is broken up into modules called methods. What is the value of c after the following line of code is executed? a = 2 b = 4 c = a * b / b + 3 * a; A. 6 *B. 8 C. 10 D. 12 What is the result of compiling and executing this code? public class TestShort{ public static void main(String[] args) { short num; byte x = 2; byte y = 3; num = x + y; } } A. The value of num is 5. B. The compile will fail because a byte cannot fit into a short. *C. The compile will fail because the + operator sees the operands as type int. D. The compile will not fail because a literal number, like 3, cannot be assigned to a byte variable. The literal number is seen as an int. Which of the following statements regarding shift operators is true? A. Shift operators work with integer primitives only. B. The shift the right operand by the number of bits specified by the left operand. C. The operands should not be an int. *D. When doing the manipulation of bits on primates larger than 32 bits, the compiler will automatically reduce the primitives to 32 bits. What are legal types for the evaluated expression in a switch statement? A. floating point B. long expression C. class references *D. char types If a class has a private String field to hold an account number called acctNum, and a public method called getAcctNum() that returns this account number String, which line of code would assign the length of the account number to the variable lenAcct? The reference to this class is named ba. A. lenAcct = ba.length().acctNum; B. lenAcct = length(acctNum); C. lenAcct = getAcctNum().length(); *D. lenAcct = ba.getAcctNum().length(); Which of the following operators has the highest precedence? A. addition B. modulus C. division *D. parentheses Is it ever possible to assign the value of variable with a double value to a float variable? *A. Yes, but a type cast must be done and there could be loss of data. B. Yes, as long as the programmer does a type cast, cast, no data will be lost. C. No, this type of assignment is not allowed. D. Yes, the assignment statement itself will convert the data. What happens when the following lines of code are compiled and run? float x; x = 3.4; *A. The code will not compile. B. The value of x will be 3.4. C. The code will compile but it will produce a runtime error. D. The code will compile but it will produce a warning. Which line of code will correctly assign the value of "passing" to the String msg if the value of points is at least 75? A. String msg = points > 75? "passing" : "not passing"; *B. String msg = points >= 75? "passing" : "not passing"; C. String msg = points > 75? "not passing" : "passing"; D. String msg = points >= 75? "passing" , "not passing"; What is the value of x after this statement executes? int x = 14/5 * 5; A. 14 *B. 10 C. 15 D. 0.56 The dot operator is used to do which of the following operations? A. The dot operator is used to set an attributes value. B. The dot operator is used to create new object behaviors. C. The dot operator is used to create an object. *D. The dot operator is used to access non-private methods or member data of an object. What is the value of num after this assignment statement? double num = 24.0 / 2.0 * 3 + 2; A. 60.0 B. 6.0 *C. 38.0 D. it will not compile because of mixed types Which of the following answers is the correct way to declare a Boolean variable named truth? *A. boolean truth = true; B. boolean truth = false C. boolean truth == true; D. boolean = true; What is the term is used to describe the data flow in and out of a Java program? A. loop *B. stream C. cast D. operator 5. Basics of Defining and Using Classes Which best describes the signature of a method? A. The signature describes the type of value a method will return. *B. The signature describes the interface to the method: the method name, type, and number of arguments expected. C. The signature states whether the method is assessable from outside the class. D. The signature contains the code the method executes. Which of the following instance variables for a BankAccount class would be declared as final? A. accoun
/
本文档为【java期末100选择题】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索