Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Which of these is correct way of inheriting class A by class B? Select one: O a. class B + class A | O b.

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Which of these is correct way of inheriting class A by class B? Select one: O a. class B + class A | O b. class B inherits class A) O c. class B extends A? d. class B extends class A? Question 2 Not yet answered Which of these methods of class String is used to check whether a given object starts with a particular string literal? Marked out of 1.00 Flag question Select one: O a. startsWith o bends With O c. Starts Odendo Question 4 To access the last object in a given Array of Object of Staff class Not yet answered Marked out of 1.00 Flag question Select one: O a. ssss.length-1).printInfo(); O b. ssss.length).printInfo(); O c. ss.printInfo(: O d. ss[5].printInfo(); Question 5 final class Circle: means that: Not yet answered Marked out of 1.00 p Flag question Select one: a. All Circle methods cannot be overridden. O b. All Circle methods cannot be overloaded. O c. Class Circle cannot be extended (Can not have sub class). O d. Class Circle cannot have a constructor. Assume StringBuffer strBuf is "Petra University", after invoking ----- "Petra City University". strBuf contains Question 6 Not yet answered Marked out of 1.00 p Flag question Select one: a strBuf.insert(6, "City ). b. str Buf.insert(5, "City"); c. strBuf append(6, "City "); OdstrBuf insert("City "); Suppose you wish to provide an accessor method for a boolean property finished, what signature of the method should be? Question 7 Not yet answered Marked out of 1.00 p Flag question Select one: O a public void getFinished() O b. public boolean getFinished(boolean finished) O c. public boolean isFinished Od public void isFinished) In order to restrict a variable of a class from inheriting to subclass, how variable should be declared? Question 8 Not yet answered Marked out of 1.00 p Flag question Select one: O a. Protected O b. Private O c. Public d. Static Question 11 What will be the output of the following Java code? Not yet answered class output Marked out of 1.00 { p Flag question public static void main(String args) { String c = "Hello i love java"; boolean var; var = c.startsWith("hello"); System.out.println(var); } } Select one: a true O b. false O c.0 O d. 1 Item > Food -name: String price: double - + TAX = 0.16 + getCalories(): int Foodltem - description: String - calories: int The Correct code for class FoodItem is: Select one: a. class FoodItem extends Item implements Food b. class FoodItem extends Item Food O c class FoodItem implements Item, Food d. class FoodItem implements Food extends Item Using which of the following, multiple inheritance in Java can be implemented? Question 14 Not yet answered Marked out of 1.00 p Flag question Select one: O a. Interfaces O b. Multithreading O c. Protected methods Od. Private methods Question 16 What will be the output of the following Java program? Not yet answered class output Marked out of 1.00 { p Flag question public static void main(String args[]) { String c = " Hello World "; String s = c.trim(); System.out.println("\""++"\""); } } Select one: O a. "Hello World" O b. "Hello World" O c. "Hello World" Od. Hello world Question 17 Not yet answered To access the second object in a given Array of Object of Staff class Marked out of 1.00 p Flag question Select one: O a. ss[1] printInfo(); O b. ss(2).printInfo(); c. ss[3].printinfo: O d. ss[4].printInfo(): Question 19 What will be the output of the following Java program? Not yet answered class String_demo Marked out of 1.00 { p Flag question public static void main(String args[l) { char chars[] = {'a', 'b', 'c'); String s = new String(chars); String sl = "abcd"; int lenl = sl.length(); int len2 = s.length(); System.out.println(lenl +""+ len2); } } Select one: O a. 30 O b. 03 O c. 34 O d. 43 Question 23 Not yet answered What will be the output of the following Java program? class String_demo Marked out of 1.00 { p Flag question public static void main(String args[]) { char chars[] = {'a', 'b', 'c'}; String s = new String(chars); System.out.println(s); } } Select one: , O b. b Occ O d. abc Which of these operators can be used to concatenate two or more String objects? Question 24 Not yet answered Marked out of 1.00 Select one: O a. + p Flag question O b. + O c. & O d. 11

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn Mysql The Easy Way A Beginner Friendly Guide

Authors: Kiet Huynh

1st Edition

B0CNY7143T, 979-8869761545

More Books

Students also viewed these Databases questions