Answer:
public static boolean isPalindrome(String word) {
//TODO: Complete this method
String reverse = "";
for (int i = (word.length()-1); i>=0; i--) {
if(word.charAt(i)!=' '){
reverse+=word.charAt(i);
}
}
String without_space = word.replaceAll(" ", "");
return reverse.equals(without_space);
}
Answer: A) It is directly accessible only in B1
Explanation: In the given chunk of code, Class B1 is a base class. Class B2 is derived class of class B1. Class B3 is derived class of B2. As you can see class B1 has two members or instance variables i and j. Instance variable cannot be directly accessible by both B2 and B3. If you see this statement of the given code private int j; the keyword private is used with the variable j. This keyword is called access specifier. Access specifiers specifies how the members of a class can be accessed. These members are attributes and methods of that class. Any member of a class that are declared private cannot be inherited by derived classes of that class. Additionally these private members cannot be accessed from within any method inside derived class. So j is directly accessible only in B1. You can access a private instance variable from within the same class or can access it through the methods of class.
Answer:
The correct answer to this question is option (1).
Explanation:
Let x1 = Is number of pages that printer A can print in page/minute.
thus x1 + 5 = Is number of page that printer B can print in page/minute.
As printer A finishes his work in 60 min. So the task has 60x1 pages. As printers A and B both finish that task in 24 minutes. So the equation can be given as:
60x1 = 24x1 + 24(x1 + 5)
60x1 = 24x1 + 24x1 + 120
60x1=48x1 + 120
60x1-48x1=120
12x1=120
x1=120/12
x1=10
put the value of x1 in to (60x1). Therefore, the task has 60(10) = 600 pages. the task contains 600 pages.
So the answer to this question is option (1).
Answer:
void doublelt(int *number)
{
*number=*number*2;
}
Explanation:
This exercise is for you to learn and understand the PASS BY POINTER syntax. The importance of this is that if you didnt use a pointer you would have to RETURN an int from the function. in that case the code would be:
int doublelt(int number)
{
number=number*2;
return number;
}
Passing by pointer manipulates the value by going inside the memory and where it resides. Without the pointer, the function would create COPIES of the argument you pass and delete them once the function ends. And you would have to use the RETURNED value only.
Answer:
1. Design system to avoid theatre tickets selling issue.
2. Resources provided to student who can built a system for the theatre tickets booking.
3. Medallion Theatre Booking System
Add/edit patron
Add/edit production
Add/edit performance
Add/edit seats
Purchase tickets
Generate Tickets Sold Report
4.GUI or graphical user interface allows the user to connect through graphical icons.
Explanation:
The main purpose is to avoid problems of duplicate tickets sales in future. The system will enable the selling of each seat to one customer only and when an attempt is made to resold the seat the system warns the user creating a check for original sale. This will help theatre to avoid any issues in future and customers will be happy with their ease of confirmation of booking.