What is the effect of evaluation of following expression? Select the one correct answer. ${'cat' gt 'cap'}

  1. true

  2. false

  3. catcap

  4. The expression does not compile as gt operator cannot be applied on strings.


Correct Option: A

AI Explanation

To answer this question, you need to understand the comparison operators in programming.

In the given expression, "gt" is a comparison operator that stands for "greater than". When comparing two strings using the "gt" operator, it checks if the first string is lexicographically greater than the second string.

In this case, the expression '${'cat' gt 'cap'}' will evaluate to true. This is because in lexicographical order, 'cat' comes after 'cap'. Therefore, the expression is true.

The correct answer is A) true.

Find more quizzes: