CramX Logo
IST242 Computer Science Midterm Exam With Answers (65 Solved Questions) - Document preview page 1

IST242 Computer Science Midterm Exam With Answers (65 Solved Questions) - Page 1

Document preview content for IST242 Computer Science Midterm Exam With Answers (65 Solved Questions)

IST242 Computer Science Midterm Exam With Answers (65 Solved Questions)

Familiarize yourself with exam difficulty levels using IST242 Computer Science Midterm Exam With Answers, packed with past exams.

Mason Bennett
Contributor
4.3
0
12 months ago
Preview (11 of 36 Pages)
100%
Log in to unlock
Page 1 of 11
IST242 Computer Science Midterm Exam With Answers (65 Solved Questions) - Page 1 preview imageMIDTERM EXAM (Concepts)DueFeb 28 at 11:59pmPoints65Questions65AvailableFeb 27 at 12pmFeb 28 at 11:59pm1 dayTime Limit80 MinutesThis quiz was locked Feb 28 at 11:59pm.Aempt HistoryAttemptTimeScoreLATESTAttempt 145 minutes65 out of 65Score for this quiz:65out of 65Submitted Feb 27 at 1pmThis attempt took 45 minutes.1 / 1 ptsQuestion 1Which of the following are considered members of a class?Private instance variables and methods.All instance variables and methods.Correct!Correct!Nonstatic instance variables and methods.Public instance variables and methods.1 / 1 ptsQuestion 2Given the following class definition, which of the following are NOTconsidered part of the class’s public interface?publicclassMotorcycle
Page 2 of 11
IST242 Computer Science Midterm Exam With Answers (65 Solved Questions) - Page 2 preview image
Page 3 of 11
IST242 Computer Science Midterm Exam With Answers (65 Solved Questions) - Page 3 preview image{publicstaticfinalintWHEEL_COUNT=2;privateintrpmRating;publicvoidupdatePrice(doubleincrease){…}privateStringdesignCode(){…}}rpmRatinganddesignCodeCorrect!Correct!WHEEL_COUNTanddesignCodeWHEEL_COUNTandupdatePriceupdatePriceanddesignCode1 / 1 ptsQuestion 3The public constructors and methods of a class form the public _____ of theclass.interfaceCorrect!Correct!initializationimplementationencapsulation1 / 1 ptsQuestion 4Which of the following statements about classes is correct?
Page 4 of 11
IST242 Computer Science Midterm Exam With Answers (65 Solved Questions) - Page 4 preview imageA class is an object that can be manipulated by a program.A class describes a set of objects with the same behavior.Correct!Correct!Class is another name for a method.A class can contain only methods.1 / 1 ptsQuestion 5You have created a Motorcycle class which has a constructor with noparameters. Which of the following statements will construct an object of thisclass?Motorcycle myBike;Motorcycle myBike = new Motorcycle();Correct!Correct!myBike.new(Motorcycle);Motorcycle.new(myBike);1 / 1 ptsQuestion 6Data required for an object's use are stored in ____.local variablesinstance variablesCorrect!Correct!parametersmethods
Page 5 of 11
IST242 Computer Science Midterm Exam With Answers (65 Solved Questions) - Page 5 preview image1 / 1 ptsQuestion 7An instance variable declaration consists of ____.the return type, the name of the method, and a list of the parameters (if any).an access specifier, the type of the instance variable, and the name of theinstance variable.Correct!Correct!an access specifier, a list of the parameters (if any), and the body of themethod.the type of the instance variable, an access specifier, a list of the parameters(if any), and the body of the method.1 / 1 ptsQuestion 8Which of the following statements is true regarding classes?Each object of a class has a separate copy of each instance variable.Correct!Correct!All objects created from a class share a single set of instance variables.Private instance variables can be accessed by any user of the object.Public instance variables can be accessed only by the object itself.
Page 6 of 11
IST242 Computer Science Midterm Exam With Answers (65 Solved Questions) - Page 6 preview image1 / 1 ptsQuestion 9A method in a class that returns information about an object but does notchange the object is called a/an ____ method.mutatoraccessorCorrect!Correct!voidconstructor1 / 1 ptsQuestion 10Consider the following code snippet:publicclassVehicle{...publicvoidsetVehicleAttributes(Stringattributes){...}publicStringgetVehicleAtrributes(){...}publicStringgetModelName(){...}}Assuming that the names of the methods reflect their action, which of thefollowing statements about this class is correct?setVehicleAttributesis an accessor method.setVehicleAttributesis a mutator method.Correct!Correct!
Page 7 of 11
IST242 Computer Science Midterm Exam With Answers (65 Solved Questions) - Page 7 preview imagegetVehicleAttributesis a mutator method.getModelNameis a mutator method.1 / 1 ptsQuestion 11Which type of method modifies the object on which it is invoked?Constructor method.Static method.Accessor method.Mutator method.Correct!Correct!1 / 1 ptsQuestion 12The utility that formats program comments into a set of documents that youcan view in a Web browser is called ____.javadocCorrect!Correct!javacjavadjava1 / 1 ptsQuestion 13
Page 8 of 11
IST242 Computer Science Midterm Exam With Answers (65 Solved Questions) - Page 8 preview imagePrivate instance variables ___.can only be accessed by methods of a different classcan only be accessed by methods of the same classCorrect!Correct!cannot be accessed by methods of the same classcan only be accessed by the constructor of the class1 / 1 ptsQuestion 14Which of the following declares asideLengthinstance variable for aSquareclass that stores an integer value?privateintegersideLength;privateintsideLength;Correct!Correct!publicintegersideLength;publicintsideLength;1 / 1 ptsQuestion 15You should declare all instance variables as ___.protectedclasspublic
Page 9 of 11
IST242 Computer Science Midterm Exam With Answers (65 Solved Questions) - Page 9 preview imageprivateCorrect!Correct!1 / 1 ptsQuestion 16Which of the following statements about instance methods is correct?An instance method should always be declared as public.An instance method should always be declared as private.An instance method should be declared as public only if it is a helper method.An instance method should be declared as private only if it is a helper method.Correct!Correct!1 / 1 ptsQuestion 17Consider the following code snippet:publicintgetCoinValue(StringcoinName){...}Which of the following statements is correct?coinName is an implicit parameter.coinName is an explicit parameter.Correct!Correct!coinName is the object on which this method is invoked.coinName is an instance variable.
Page 10 of 11
IST242 Computer Science Midterm Exam With Answers (65 Solved Questions) - Page 10 preview image1 / 1 ptsQuestion 18Complete the following code snippet to create a constructor that will initializethe class instance variables shown using data provided by the programwhich is creating an object from this class.publicclassEmployee{privateStringempID;privatebooleanhourly;_______________________{...}}Which of the following statements can be used to create an object of typeEmployee?public Employee(String employeeID, boolean isHourly)Correct!Correct!public Employee(employeeID, isHourly)public Employee(empID, Hourly)public Employee()1 / 1 ptsQuestion 19Which statement calls a constructor with no construction parameters?Circle c = new Circle();Correct!Correct!Circle c = new Circle;Circle c = Circle()
Page 11 of 11
IST242 Computer Science Midterm Exam With Answers (65 Solved Questions) - Page 11 preview imageA call to a constructor must have construction parameters.1 / 1 ptsQuestion 20A constructor is invoked when ___ to create an object.the class keyword is usedthe class is defined as publicthe new keyword is usedCorrect!Correct!the class is defined as private1 / 1 ptsQuestion 21You have created aRocketclass which has a constructor with noparameters. Which of the following statements will construct an object of thisclass?Rocket myRocket;Rocket myRocket = new Rocket();Correct!Correct!myRocket.new(Rocket);Rocket.new(myRocket);1 / 1 ptsQuestion 22
Preview Mode

This document has 36 pages. Sign in to access the full document!