Login|Contact Us
Question and Answer

Programming

Ask a Programming Question, Get an Answer ASAP!

  • Ask A Question
  • Browse Answers
  • Meet The Experts
  • How JustAnswer Works

1)Suppose w, x, y and z are integer variables and initialized

 
jeff's Avatar
  • Answered by:jeff
  • Computer Software Engineer
  • Positive Feedback: 99.1 %
  • Accepted Answers: 153
Verified Expert
in Programming

Recent Feedback

Positive
A quick response, a simple interaction and a solution that worked! Thanks very...
Positive
Thanks
Positive
Jeff, nice work! The program is excellent. Good job and thanks for your help
Positive
Good Job Jeff
Positive
Excellent experience..would def work with jeff again
Positive
Thats Excellent!
Positive
great job! hope to work with you again. Thank you!1
Positive
Went above and beyond to answer my questions. Recommend!!!
Positive
Saved my life! Thank you soo much!!!
Positive
A nice easy solution expertly handled.

Customer Question

1)Suppose w, x, y and z are integer variables and initialized as follows:
w = 2; x = 3; y = 4; z = 5;
In a block of C/C++/Java code, the following statements are executed. What is the value of w after these statements are executed?
{
x = z + y;
y = 2 * x - y;
w= x + w / 2 - z
}
2)With x = 5 and y = 8 and z = 5, what is the value of the variable z after the execution of the
following pseudo-code:

If ((x = 10)) Then
z = z + 1
Else
z = z – 1
End If
3)Let X = 3 and Y = 6. Indicate by entering T or F whether the expression is TRUE or FALSE

NOT(X > 3) AND NOT(Y < X)
4)Write pseudocode to print the numbers 3, 6, 9, 12, 15, 18 and 21 using a for-loop
5) ) Using pseudocode declare a Real number named temperature
6)Using pseudocode declare a variable to store the Julian day (1-366) named JDay.
This is only 6 questions out of 100 on my review sheet for my mid term! Please help as I am soo stuck on these! Thanks

 

Optional Information:
Level/Year: Senior
Subject: Computer Programming

Already Tried:
Everything! Professor is not available until the weekend to get the answer key.

Submitted: 1119 days and 19 hours ago.
Category: Programming
Value: $20
Status: CLOSED

Accepted Answer

Picture
Expert:  jeff replied 1119 days and 15 hours ago.

1) Suppose w, x, y and z are integer variables and initialized as follows:

w = 2; x = 3; y = 4; z = 5;

In a block of C/C++/Java code, the following statements are executed.

What is the value of w after these statements are executed?
{
x = z + y;
y = 2 * x - y;
w= x + w / 2 - z
}

Satement 1: x = z + y

x = 5 + 4 = 9

Statement 2: y = 2 * x - y
Remember that x was set to 9 in Statement 1

y = 2 * 9 - 4 = 14

Statement 3: After w = x + w/2 - z is executed

w = 9 + 2/2 - 5 = 5

w = 5 is the final answer


2)
With x = 5 and y = 8 and z = 5, what is the value of the variable z after the execution of the following pseudo-code:

If ((x <= 20) && (y >= 10)) Then
z = z + 1
Else
z = z – 1
End If

The first statement checks if x is less than or equal to 20 AND if y is greater than or equal to 10. The first condition evaluates to true, but the second condition evaluates to false since y is less than 10. Therefore, the entire if statement evaluates to false, and the statement after the Else is executed.

z = z - 1 = 5 - 1 = 4

z = 4 is the final answer

3)Let X = 3 and Y = 6.
Indicate by entering T or F whether the expression is TRUE or FALSE NOT(X > 3) AND NOT(Y < X)

Let's break it down into parts:

(X > 3) = FALSE
NOT (X > 3) = TRUE

(Y < X) = (6 < 3) = FALSE
NOT(Y < X) = TRUE

Putting the two together

NOT(X > 3) AND NOT(Y < X) = TRUE AND TRUE = TRUE

TRUE is the final answer


4) Write pseudocode to print the numbers 3, 6, 9, 12, 15, 18 and 21 using a for-loop

This problem can be approached from several different angles:

The first possibility is that we loop from 3 to 21 and add 3 to the loop counter each time we print

For LoopCounter = 3; LoopCounter <= 21; LoopCounter = LoopCounter + 3
Print LoopCounter
Next

---OR we can loop from 1 to 21, and only print out the numbers that are evenly divisible by 3---

For LoopCounter = 1 to 21
If (LoopCounter MOD 3) = 0 Then
Print LoopCounter
End If
Next LoopCounter


5) Using pseudocode declare a Real number named temperature

Final Answer: Declare temperature as Real

or this could be: Declare temperature as Float

it just depends on which way you learned in class. Real is pseudocode, Float is what most real programming languages use.

6) Using pseudocode declare a variable to store the Julian day (1-366) named JDay.

Declare JDay as Integer




Expert TypeComputer Software Engineer
Category: Programming
Pos. Feedback: 99.1 %
Accepts: 153
Answered: 3/17/2010

Experience: 7 yrs. of professional programming experience. BS and MS in Computer Science.

Ask this Expert a Question >
 
Tweet

2 Programmers are Online Right Now

Ask Your Question Now
Programming Questions Date Submitted
is there a python programming person available 3/28/2013
Write a menu-driven program that allows users do two options: Option 3/27/2013
1. Which one of the following control structures provides for 3/27/2013
JavaScript: Multiple Choice Questionnaire 3/25/2013
RA-211 3/24/2013
How do you create a searchable public Google drive folder in 3/24/2013
RA-211 3/24/2013
I am an entrepreneur with no current coding skills, but an 3/23/2013
I have base code in VBA that opens all excel files from a folder 3/23/2013
Program in C++ 3/23/2013
RSS
Next 10 >
Ask A Programmer
Type Your Programming Question Here...
characters left:

Top Programming Experts

See More Programmers

In The News

Nbc
Washington Post
New York Times
Cnn
Learn More

How It Works

  • Ask an Expert
  • Get a Professional Answer
  • Ask Followup Questions
  • 100% Satisfaction Guarantee
Learn More
close
Find Expert answers related to your question.
Sign up using email
We will never post anything without your permission.
Already have an account? Sign in

Ask a Programmer

Get a Professional Answer. 100% Satisfaction Guaranteed.
224 Programmers are Online Now
Type Your Programming Question Here...
characters left:
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.
Truste
Contact Us | Terms of Service | Privacy & Security | About Us
© 2003-2013 JustAnswer LLC