Question: Solve these parts for this computer science exercise. 1a. What value does x hold in the last line of this code segment? int x =

Solve these parts for this computer science exercise.

1a. What value does x hold in the last line of this code segment?

int x = 2;

int y = x * 3;

int z = y/2;

x = (2 + z) % 2;

1b. Write a program that displays the area and perimeter of a rectangle with a width of 4.5 and a height of 9.5 using the following formula:

area = width * height

1c. What is the output for this program?

char x='S';

x++;

System.out.println(x);

char y='M';

y -= 3 + 1;

System.out.println(y);

1d. Write a program that gets the username and tells them how many characters their name consists of.

1e. Suppose we want to code 41 things.

Thus, ceiling(log2(41))=

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets solve each part of this computer science exercise step by step 1a Calculation of the Variable x ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!