100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CS 180 Final Exam Question and answers 100% solved 2023 $16.99   Add to cart

Exam (elaborations)

CS 180 Final Exam Question and answers 100% solved 2023

 3 views  0 purchase
  • Course
  • CS 180
  • Institution
  • CS 180

CS 180 Final Exam Question and answers 100% solved 2023Which of the following keywords may appear in a switch statement? Check all that apply. break default switch case All Give the base 8 representation of the following numbers 13 27 15 33 Convert the following binary numbe...

[Show more]

Preview 4 out of 34  pages

  • May 18, 2023
  • 34
  • 2022/2023
  • Exam (elaborations)
  • Questions & answers
  • give the base 8 represent
  • CS 180
  • CS 180
avatar-seller
Academia199
CS 180 Final Exam Question and answers 100% solved 2023
Which of the following keywords may appear in a switch statement? Check all that apply.
break
default
switch
case - correct answer All
Give the base 8 representation of the following numbers
13
27 - correct answer 15
33
Convert the following binary numbers to decimal values:
1001
1101 - correct answer 9
13
Given the following expression, evaluate the expression based on the given value of n. n % 100 == 0 ? n % 400 == 0 : n % 4 == 0 - correct answer true
true
false
false
Which of the following are Java keywords? Check all that apply.
int
while
Main
switch - correct answer int
switch
while
Which of the following statement is not valid?
int x = Math.min(2, 3);
int x = Math.pow(2, 3);
double x = Math.random();
int x = Math.random() > 0.1 ? 1 : 0; - correct answer int x = Math.pow(2, 3);
What's the value of sum after executing the following code segment?
int sum = 0;
for (int i = 0; i < 12; i = i + 3) { sum += i;
}
156
30
18
78 - correct answer 18
Given double x = 8;, match the values with the expressions.
true
2.5
3
2
x == x++
20 / x
11 % 8 - correct answer true - x==x++
2.5 - 20/x
3 - 11 % 8
2 - 10/4
Which of the following type of loops are pretest loops? Check all that apply.
for
while
while-do
do-while - correct answer for
while
Which of the following is most suitable to read 50 numbers from the keyboard?
a while loop
a switch statement
a do-while loop
a for loop - correct answer a for loop
Which of the following statements may have a break statement?
while
switch
do-while
for - correct answer all
Quiz 4 question True or false: Each method must have a return type (for now).
false
true - correct answer true
True or false: Each method must have at least one parameter.
false
true - correct answer false
True or false: If a method have multiple parameters, all the parameters must be of the same type.
true
false - correct answer false
True or false: Our coding convention requires that the name of a method starts with a lower case letter.
false
true - correct answer true
If a method doesn't have a return value, the return type is - correct answer void
In an implementation of public static double sqrt(double num), the programmer
computes the value of the square root, and
displayed the value of the console. The implementation violates:
Separation of concerns.
Encapsulation
Cost effective.
It is good because it has done extra work. - correct answer separation of concerns
Two methods in the same class with the same name but different parameters are _______?
overridden
a compile error
overloaded
static - correct answer a compile error
Match the key word with its description.
package
this
void
constructor
static
organizes the classes into different groups
current object the type of a method with no return values
a special method that has no return type - correct answer package - organizes the classes into different groups
this - current object
void - the type of a method with no return values
constructor - a special method that has no return type
static - a member belongs to the whole class, not individual objects
Which of the following may have a break statement inside, but not a continue statement?
do-while
switch
while
for - correct answer switch
Which of the following are non-static methods? Check all that apply.
sqrt(double val) in Math class.
charAt(int index) in String class.
area() in Circle class.
nextInt() in Scanner class. - correct answer nextInt() in Scanner class.
area() in Circle class.
charAt(int index) in String class.
Which of the following is a valid access modifier?
keyword package
keyword private
keyword public
package access when none is present - correct answer package access when none is
present
keyword private
keyword public
Given a Rectangle class, which of the following methods may be defined as static?
area()
intersect(Rectangle that)
int compare(Rectangle r1, Rectangle r2)
move(double x, double y) - correct answer int compare(Rectangle r1, Rectangle r2)
Which of the following statements about constructors are true? Check all that apply.

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Academia199. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $16.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

77764 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$16.99
  • (0)
  Add to cart