Ask Question
29 April, 05:20

n the declaration: string color = "blue"; A. the string literal color is assigned to the string reference "blue" B. the string reference color is concatenated to the string literal "blue" C. the string literal "blue" is assigned to the string reference color D. None of the above

+3
Answers (2)
  1. 29 April, 05:49
    0
    C. the string literal "blue" is assigned to the string reference color.

    Explanation:

    String literal here is blue which is a sequence of characters b, l, u, e.

    Also a string literal is enclosed in double quotation marks.

    So option A is wrong because string literal here is "blue" and not color.

    In this statement the string literal blue is not being concatenated rather the string literal is being assigned to the string reference color. So option B is wrong too.

    Assignment operator = is used here to assign this string literal to color.

    Now if we print color, the output displayed is "blue" as the color string reference holds blue string literal.
  2. 29 April, 05:49
    0
    C. the string literal "blue" is assigned to the string reference color

    Explanation:

    The statement string color = "blue" is an assignment statement.

    The syntax of an assignment is

    Variable = Value

    The expression or the value on the right hand side in the statement above is a string literal or string constant.

    The Variable it is being assigned to color is the string reference (on the left hand side). It is called the string reference because the value "blue" is of string data type.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “n the declaration: string color = "blue"; A. the string literal color is assigned to the string reference "blue" B. the string reference ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers