Language:EN
Pages: 1
Words: 279
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
review the exam pseudocode code segment below

Correct Implementation of Greeting Procedure Answer Needed

Your question:

A program's expected function is to return a greeting message, including the user's name. Review the AP Exam pseudocode code segment below. x ← INPUT() y ← greeting(x) DISPLAY(y) Which of the following is the correct implementation of the greeting() procedure? PROCEDURE greeting(name) { DISPLAY(Concat("Good Morning ", name)) } PROCEDURE greeting(x) { DISPLAY(Concat("Good Morning ", name)) } PROCEDURE greeting(name) { RETURN(Concat("Good Morning ", name)) } PROCEDURE greeting(name) { RETURN(Concat("Good Morning ", "name")) }

Correct Implementation of Greeting Procedure Answer and Explanation

B. PROCEDURE greeting(x) { DISPLAY(Concat("Good Morning ", name)) }: This procedure uses x instead of name for the greeting, resulting in an incorrect message being displayed.

D. PROCEDURE greeting(name) { RETURN(Concat("Good Morning ", "name")) }: This procedure uses the literal string "name" instead of the actual user input variable, resulting in an incomplete greeting.

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : John Drake

PageId: DOC12FEA73