📊 JavaScript
Q. The property of a primary expression is
  • (A) contains only keywords
  • (B) contains variable references alone
  • (C) stand-alone expressions
  • (D) basic expressions containing all necessary functions
💬 Discuss
✅ Correct Answer: (C) stand-alone expressions

Explanation:

A primary expression in JavaScript refers to the simplest kind of expression that doesn't depend on any other expressions to be evaluated. It typically includes:

  • Literals: Like numbers (5), strings ("Hello"), booleans (true or false).
  • Variable references: Like x or y.
  • Function calls: Like someFunction().
  • Object or array literals: Like { key: "value" } or [1, 2, 3].

Essentially, primary expressions are self-contained expressions that are the building blocks of more complex expressions.

For example:

  • 5 is a primary expression.
  • "Hello" is a primary expression.
  • x (a variable reference) is a primary expression.
  • someFunction() (a function call) is a primary expression.

Why the other options are incorrect:

  • (A) contains only keywords: Keywords like if, for, and function are not primary expressions—they are part of the syntax of control structures or declarations.
  • (B) contains variable references alone: While variable references are primary expressions, this is too narrow. Primary expressions can include more than just variables.
  • (D) basic expressions containing all necessary functions: This is also too vague and inaccurate. Primary expressions do not necessarily "contain all necessary functions."

So, (C) stand-alone expressions is the most accurate description.

Explanation by: Praveen Singh

A primary expression in JavaScript refers to the simplest kind of expression that doesn't depend on any other expressions to be evaluated. It typically includes:

  • Literals: Like numbers (5), strings ("Hello"), booleans (true or false).
  • Variable references: Like x or y.
  • Function calls: Like someFunction().
  • Object or array literals: Like { key: "value" } or [1, 2, 3].

Essentially, primary expressions are self-contained expressions that are the building blocks of more complex expressions.

For example:

  • 5 is a primary expression.
  • "Hello" is a primary expression.
  • x (a variable reference) is a primary expression.
  • someFunction() (a function call) is a primary expression.

Why the other options are incorrect:

  • (A) contains only keywords: Keywords like if, for, and function are not primary expressions—they are part of the syntax of control structures or declarations.
  • (B) contains variable references alone: While variable references are primary expressions, this is too narrow. Primary expressions can include more than just variables.
  • (D) basic expressions containing all necessary functions: This is also too vague and inaccurate. Primary expressions do not necessarily "contain all necessary functions."

So, (C) stand-alone expressions is the most accurate description.

💬 Discussion


📊 Question Analytics

👁️
213
Total Visits
📽️
4 y ago
Published
🎖️
Kirti
Publisher
📈
99%
Success Rate