EXAM2ExampleQuestions

# EXAM2ExampleQuestions - EXAM 2 Example Questions Logic A =...

This preview shows pages 1–3. Sign up to view the full content.

EXAM 2 Example Questions Logic A = I ate potatos B = I ate beans A->~B = If I ate potatoes then I did not eat beans A ^ B = I ate potatoes and I ate beans I did not eat potatos and I ate beans = ~A ^ B I ate beans or I did not eat potatos = B v ~A Fill in the code Given a variable x , if x equals 10 output “that’s great number” otherwise output “not so great, but ok” if (x==10) { alert("that's a great number"); } else { alert("not so great, but ok"); } Given a variable count Write a loop that outputs the numbers 1 to count on separate lines in bold var mycounter=1; while (mycounter <=count) { document.write(“<b>” + mycounter + “</b><br/>”); mycounter++; } Value Tracing

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
var a = 1; var b = 3; var z = 12; while (a<b) { a+=2; z--; } What does z equal? Z is equal to 11. Coding Ask the user for a set numbers one at a time. Keep track of the count of numbers entered and the total of numbers entered. At the end output the total, count and average on
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

EXAM2ExampleQuestions - EXAM 2 Example Questions Logic A =...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online