Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please answer the question with the correct ans!! Quention 30 Not yef answered Marhed out of 200 Consider the code snippet below; int[] numbers -
please answer the question with the correct ans!!
Quention 30 Not yef answered Marhed out of 200 Consider the code snippet below; int[] numbers - neu int[2]; munbers[e] - 1; nutbers [1] - 2; fooinumbers[1]]; Where foo() is a method that accepts as argument an array of integers. Now if we attempt to make changes to the integer argument of foo() inside foo() which one of the following is correct? a. The actual elements of the numbers array will be changed b. The actual elements of the numbers array will NOT be changed c. Compilation succeeds, but an exception is thrown at runtime. d. A compiler error results Questien 31 Not yet anewered Marked out of 200 If the base type of an array is an object type, each element of the array holds a. 0 b. the actual value of that element c. a reference to an object of that type d. ntill Quettion 32 Not yet answered Marked auf of 200 Assume you have two programmer-defined classes Nyclassa and nyclasss such that nyclassa has a member variable private MyclassB ncb. To preserve encapsulation, you write an acoessor function for acb as follows; pubilic Hyclass gethicb() \{ return this,ncb: ) Does this function preserve encapsulation? Wry or why not? a. No, because it is a public method and ncb is a private variable. b. No, because it returns a reference to a private object variable c. Yes, because acoessor functions make variables avalable as read-only attributes. d. Yes, because a user can access the variable via the accessor function. questen 33 Not yet anawei ed Marked out ef 2.00 A variable holds the memory address of an object, not the object itself. a. reference b. String c. byte d. primitive Queation 34 Not yet answered Marked out of 200 Select the primitive data types in Java. a. float b. null c. char d. int e Scanner f. boslean g. File h. string queation 35 Not yet ariwered Marked out of 2.00 What is printed out as a result of the following code snipper? string s a "First'; s.tobpercase(); Systen-out, peintlin(s); a. x b. first c FIRST d. First Question 36 Not yet answered Marked out of 200 Which of the following are "repetition statements" in Java? a. if felse b. for c. Ternary operator ? : d. while e. switch...case Question 37 Not yet answered Marked out of 2.00 All programmer-defined types in Java share a common ancestor class. What is it? Answer Question 38 Not yet answered Marked out of 200 Suppose the following statement is true: xes can do . Which of the following statements is most accurate? a. v should be implemented as a class attribute of x. b. Y should be implemented as a instance attribute of x. c. y should be implemented as a instance method of x. Question 39 Not yet answered Marked out of 2.00 Which of the following events can cause an Exception to be thrown? a. b was zero when "int remainder b. Scanner. nextint() received input of "forty-two". c. An invalid filename was passed to the constructor of a File object. d. You attempted to create an object that was bigger than the free memory space available. e. a \% b; was executed. Question 40 Not yet answered Marked out of 200 One method can have at most varargs parameters. Question 41 Not yet answered Marked cut of 2.00 In Java, it is possible to write code outside of classes. Select one: True False question 42 Not yet answeing Marked out of 2.00 When writing a method that can take zero or more int values as irput, the typename int must be appended with the operator. a. + b. c. [] d. +. e. 8 Question 43 Not yet artinered Marked out of 2.00 If the base type of an array is a primitive type, and we do NOT explicitly initiatize its values, what happens? a. A compiler error results. b. Each element of the arroy is automatically initialized to zero. c. Compilation succeeds, but an exception is thrown at runtirne. d. Each element of the array is automatically initialized to nu11. Question 44 Nor yet answered Maked out of 200 What is printed at the command line by the following Java sripget systen.out.printin ("The answer to Iife, the universe, and everythdng is (4+2)}; a. "The answer to life, the universe, and everything is 42 " b. "The answer to life, the universe, and everything is 6 " c. Nothing, this code results in an error. d. The answer to life, the universe, and everything is +4+2 " Question 45 Not yet answered Marked out of 2.00 Which of the following data types can represent the largest value? a. int b. float Question 46 Not yet answered Marked out of 2.00 In object-oriented programming, methods are the in a description of a system. a. verbs b. adjectives c. propositions d. nouns Question 47 Not yet answered Marked out of 2.00 Which of the following statements about method overloading are true? a. The methods involved have the same name, but different signatures. b. A method can override a method defined in the same class. c. The methods involved have exactly the same signature. d. A method can only overload methods defined in a superclass. Quettien 48 Not yet answered Marked out of 2.00 The value of "He11o", conpareTo("hello"); is a. false b. Uniknown c. Irue d. 0 e. positive f. negative Question 49 Not yet answered Marked out of 200 The following code snippet changes the value of the String str: String str - "Some string"; string stre str. touppercase(); Select one: True False Question 50 Not yet answered Marked out of 2.00 Assume we have already defined two classes, Animatedshape and Mexagon. Using only the extends functionality of Java, can we create a new class Aninatediexagon? a. No b. Yes Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started