Java How to Program, 5/e Test Item File 1 of 5



Similar documents
CSCI 253. Object Oriented Programming (OOP) Overview. George Blankenship 1. Object Oriented Design: Java Review OOP George Blankenship.

Chapter 1 Fundamentals of Java Programming

Glossary of Object Oriented Terms

5.2 Q2 The control variable of a counter-controlled loop should be declared as: a.int. b.float. c.double. d.any of the above. ANS: a. int.

Fundamentals of Java Programming

Many applications consist of one or more classes, each containing one or more methods. If you become part of a development team in industry, you may

Course MS10975A Introduction to Programming. Length: 5 Days

UML for C# Modeling Basics

Java Interview Questions and Answers

Description of Class Mutation Mutation Operators for Java

Java Application Developer Certificate Program Competencies

Course Title: Software Development

Source Code Translation

C PROGRAMMING FOR MATHEMATICAL COMPUTING

Object-Oriented Programming Lecture 2: Classes and Objects

CEC225 COURSE COMPACT

Patterns in. Lecture 2 GoF Design Patterns Creational. Sharif University of Technology. Department of Computer Engineering

Formal Engineering for Industrial Software Development

Moving from CS 61A Scheme to CS 61B Java

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Curriculum Map. Discipline: Computer Science Course: C++

Lab Manual: Using Rational Rose

The Sun Certified Associate for the Java Platform, Standard Edition, Exam Version 1.0

Java (12 Weeks) Introduction to Java Programming Language

INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011

Introduction to Object-Oriented Programming

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

CS 111 Classes I 1. Software Organization View to this point:

Java SE 8 Programming

Lecture 7 Notes: Object-Oriented Programming (OOP) and Inheritance

Exam : 1Y Citrix Access Gateway 4.2 with Advanced Access Control:Admin. Title : Version : DEMO

Object Oriented Design

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

Software Engineering. Software Engineering. Component-Based. Based on Software Engineering, 7 th Edition by Ian Sommerville

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

Organization of Programming Languages CS320/520N. Lecture 05. Razvan C. Bunescu School of Electrical Engineering and Computer Science

History OOP languages Year Language 1967 Simula Smalltalk

VB.NET - CLASSES & OBJECTS

Debugging. Common Semantic Errors ESE112. Java Library. It is highly unlikely that you will write code that will work on the first go

Java Classes. GEEN163 Introduction to Computer Programming

D06 PROGRAMMING with JAVA. Ch3 Implementing Classes

Introduction to Object-Oriented Programming

UNIVERSITY OF CALIFORNIA BERKELEY Engineering 7 Department of Civil and Environmental Engineering. Object Oriented Programming and Classes in MATLAB 1

Java Programming. Binnur Kurt Istanbul Technical University Computer Engineering Department. Java Programming. Version 0.0.

Install Java Development Kit (JDK) 1.8

How To Write A Program In Java (Programming) On A Microsoft Macbook Or Ipad (For Pc) Or Ipa (For Mac) (For Microsoft) (Programmer) (Or Mac) Or Macbook (For

1. What are Data Structures? Introduction to Data Structures. 2. What will we Study? CITS2200 Data Structures and Algorithms

El Dorado Union High School District Educational Services

PHP Code Design. The data structure of a relational database can be represented with a Data Model diagram, also called an Entity-Relation diagram.

Agile Software Development

Java SE 7 Programming

core. Volume I - Fundamentals Seventh Edition Sun Microsystems Press A Prentice Hall Title ULB Darmstadt

Lecture 1 Introduction to Android

Comp 411 Principles of Programming Languages Lecture 34 Semantics of OO Languages. Corky Cartwright Swarat Chaudhuri November 30, 20111

Aspect-Oriented Programming

Johannes Sametinger. C. Doppler Laboratory for Software Engineering Johannes Kepler University of Linz A-4040 Linz, Austria

Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is

Course Number: IAC-SOFT-WDAD Web Design and Application Development

1. Overview of the Java Language

Systems Integration: Co C mp m onent- t bas a e s d s o s ftw ft a w r a e r e ngin i eeri r n i g

Java SE 7 Programming

Java CPD (I) Frans Coenen Department of Computer Science

Java SE 7 Programming

Programming Languages

Server-Side Scripting and Web Development. By Susan L. Miertschin

UML FOR OBJECTIVE-C. Excel Software

Quality Management. Objectives

Quality Management. Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 27 Slide 1

13 Classes & Objects with Constructors/Destructors

DIPLOMADO DE JAVA - OCA

Java Programming Language

INTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 7: Object-Oriented Programming. Introduction

Introduction to Object-Oriented Programming in MATLAB

Algorithms, Flowcharts & Program Design. ComPro

Computer Information Systems (CIS)

CS 209 Programming in Java #1

C++ Programming Language

Chapter 4 OOPS WITH C++ Sahaj Computer Solutions

Quality Management. Objectives. Topics covered. Process and product quality Quality assurance and standards Quality planning Quality control

Definitions. Software Metrics. Why Measure Software? Example Metrics. Software Engineering. Determine quality of the current product or process

Java for WebObjects Developers. Provides a quick-start guide for developers learning to use Java with WebObjects

The C Programming Language course syllabus associate level

C Compiler Targeting the Java Virtual Machine

Dynamic Adaptability of Services in Enterprise JavaBeans Architecture

CS-XXX: Graduate Programming Languages. Lecture 25 Multiple Inheritance and Interfaces. Dan Grossman 2012

C++ INTERVIEW QUESTIONS

IS0020 Program Design and Software Tools Midterm, Feb 24, Instruction

AP Computer Science A - Syllabus Overview of AP Computer Science A Computer Facilities

Gadget: A Tool for Extracting the Dynamic Structure of Java Programs

Web Development in Java

Computer Programming I

JAVA - INHERITANCE. extends is the keyword used to inherit the properties of a class. Below given is the syntax of extends keyword.

Checking Access to Protected Members in the Java Virtual Machine

Transcription:

Java How to Program, 5/e Test Item File 1 of 5 Chapter 8 Section 8.1 8.1 Q1: Object-Oriented Programming encapsulates: a.data and methods. b.information hiding. c.classes. d.adjectives ANS: a. Data and methods Section 8.2 8.2 Q1: If class A extends B, then: a.class A is the base class. b.class A is the superclass. c.class A inherits from class B. d.class B is the derived class. ANS: c. Class A inherits from class B. Class B is the base class or superclass. Class A is the derived class or subclass. 8.2 Q2: Constructors: a.have the same name as the class. b.may not specify a return type. c.initialize objects of a class. Section 8.3 8.3 Q1: An instance variable is hidden in the scope of a method when a.the instance variable has the same name as the method. b.the instance variable has the same name as a local variable in the method. c.the instance variable has the same name as the class. d.the instance variable has the same name as the file. ANS: b. The instance variable has the same name as a local variable in the method. 8.3 Q2: Which of the following statements is true? a.within a class s scope, class members are accessible to all of that class s methods, but cannot be referenced directly by name. b.it is a syntax error if a method declares a local variable with the same name as a variable declared in the method s enclosing class. c.variables declared in a method are known only to that method. d.none of the above. ANS: c. Variables declared in method are know only to that method. Section 8.4 8.4 Q1: Which of the following should usually be private? a.methods. b.constructors. c.variables (or fields). ANS: c. Variables (or fields). 8.4 Q2: Which of the following statements is true? a.methods and instance variables can both be either public or private. b.information hiding is achieved by restricting access to class members via keyword public. c.the private members of a class are directly accessible to the client of a class. d.none of the above is true. ANS: a. Methods and instance variables can both be either public or private.

Java How to Program, 5/e Test Item File 2 of 5 Section 8.5: 8.5 Q1: When should a program explicitly use the this reference: a.accessing a private variable. b.accessing a public variable. c.accessing a local variable. d.accessing a field that is shadowed by a local variable. ANS: c. Accessing a field that is shadowed by a local variable. 8.5 Q2: Having a this reference allows: a.a method refer explicitly to the instance variables and other methods of the object on which the method was called. b.a method to refer implicitly to the instance variables and other methods of the object on which the method was called. c.an object to reference itself. Section 8.6 8.6 Q1: A constructor cannot: a.be overloaded. b.initialize variables to their defaults. c.specify return types or return values. d.have the same name as the class. ANS: c. Specify return types or return values. 8.6 Q2: Which of the following will be used to create an instance of a class if the programmer does not define a constructor? a.a default constructor. b.an overloaded constructor. c.the Object class constructor with the name of the desired class passed in as an argument. d.if no constructor is written, then one isn t needed. ANS: a. A default constructor. Section 8.7 8.7 Q1: Constructors: a.initialize instance variables. b.when overloaded, can have identical argument lists. c.when overloaded, are selected by number and types of parameters. d.a and c. ANS: d. a and c. 8.7 Q2: A well-designed group of constructors: a.guarantee the object is created in a consistent state. b.may call common methods. c.allows the class's user flexibility in specifying some or all of the initial instance variable values. ANS d. All of the above. Section 8.8 8.8 Q1: Not using set and get methods is: a.a syntax error. b.a logic error. c.not good program design. d.none of the above. ANS: c. Not good program design.

Java How to Program, 5/e Test Item File 3 of 5 8.8 Q2: Using public set methods provides data integrity if: a.the instance variables are public. b.the instance variables are private. c.the programmer provides validity checking. d.both b and c. ANS: d. Both b and c. Section 8.9 8.9 Q1: Composition: a.is a form of software reuse. b.is using an object reference as a class member. c.is a good design practice. Section 8.10 8.10 Q1: Which of the following is not true? a.finalizer methods typically return resources to the system. b.memory leaks using Java are rare because of garbage collection. c.objects are marked for garbage collection by the finalizer. d.the garbage collector reclaims unused memory. ANS: c. Objects are marked for garbage collection by the finalizer. Object are marked for garbage collection when there are no more references to the object Section 8.11 8.11 Q1: Static class variables: a.are final. b.are public. c.are private. d.are shared by all objects of a class. ANS: d. Are shared by all objects of a class. 8.11 Q2: Which of the following is not true? a.a static method must be used to access private static instance variables. b.a static method has no this reference. c.a static method can be accessed even when no objects of its class have been instantiated. d.a static method can call instance methods directly. ANS: d. A static method can call instance methods directly. Section 8.12 8.12 Q1: Instance variables declared final do not or cannot: a.use the principle of least privilege. b.be initialized. c.be modified. d.cause syntax errors if used as a left-hand value. ANS: c. Be modified. Section 8.13 8.13 Q1: A package is: a.a directory structure used to organize classes and interfaces.

Java How to Program, 5/e Test Item File 4 of 5 b.a mechanism for software reuse. c.a group of related classes and interfaces. 8.13 Q2: A class within a package must be declared public if a.it will only be used by other classes in the same package. b.it will be used by classes that are not in the same package. c.it is in the same directory as the other classes in the package. d.it has a unique name. ANS: b. It will be used by classes that are not in the same package. Classes outside the package cannot use a class if the class is not declared public. 8.13 Q3: Consider the statement package com.deitel.jhtp5.ch08; a.the statement declares a package that exists at deitel.com. b.the statement uses the Sun Microsystems convention of package naming. c.the statement specifies a package that can be imported using: import com.deitel.ch08. d.the statement will generate a compile time error. ANS: b. The statement uses the Sun Microsystems convention of package naming. Section 8.14 8.14 Q1: When no member access modifier is specified for a method or variable, the method or variable: a.is public. b.is private. c.has package access. d.is static. ANS: c. Has package access. Section 8.15 8.15 Q1: Java programmers do not focus on: a.crafting new classes and reusing existing classes. b.understanding class library implementations c.carefully testing classes they design. d.carefully documenting classes they design. ANS: b. Understanding class library implementations. Information hiding and well-defined interfaces free Java programmers from needing to understand existing class library implementations. 8.15 Q2: Which of the following does not contribute to improved software reusability? a.quickly creating new class libraries without testing them thoroughly. b.licensing schemes and protection mechanisms. c.descriptions of classes that allow programmers to determine whether a class fits their needs. d.cataloging schemes and browsing mechanisms. ANS: Quickly creating new class libraries without testing them thoroughly. Section 8.16 8.16 Q1: Abstract Data Types: a.elevate the importance of data. b.are only approximation or models of real-world concepts and behaviors. c.capture tow notions, data representation and operations. 8.16 Q2: The term information hiding refers to: a.public methods. b.hiding implementation details from clients of a class. c.accessing static class members.

Java How to Program, 5/e Test Item File 5 of 5 d.the process of releasing an object for garbage collection. ANS: b. Hiding implementation details from clients of a class.