With respect to C programming, four statements are given below. Identify the FALSE statement.

This question was previously asked in
ISRO VSSC Technical Assistant 11 Feb 2024 Official Paper
View all ISRO Technical Assistant Papers >
  1. The statement y = x + *p; sets y to the value of x added with the value pointed to by p
  2. All operators in C have associativity from right to left
  3. Assignment has lower precedence than comparison operator
  4. intcalender [31] [12] means that calender is an array of 31 arrays of 12 int elements each

Answer (Detailed Solution Below)

Option 2 : All operators in C have associativity from right to left
Free
ISRO Technical Assistant Mechanical Full Mock Test
2.7 K Users
80 Questions 80 Marks 90 Mins

Detailed Solution

Download Solution PDF

Explanation:

Analysis of Correct Option:

The correct answer is Option 2: "All operators in C have associativity from right to left."

This statement is FALSE because not all operators in C have associativity from right to left. While some operators, such as assignment operators and unary operators, do have right-to-left associativity, the majority of operators in C, including arithmetic, logical, and relational operators, have left-to-right associativity. Associativity determines the order in which operators of the same precedence are evaluated in an expression. The precedence and associativity of operators in C are critical for writing correct and predictable code, as they influence how expressions are parsed and executed.

Understanding Operator Associativity:

In C programming, operator associativity defines the direction in which operators with the same precedence are evaluated. The two types of associativity are:

  • Left-to-Right Associativity: Operators with left-to-right associativity are evaluated from left to right. This is the default associativity for most operators, such as arithmetic (+, -, *, /, %), comparison (==, !=, <, >, <=, >=), and logical operators (&&, ||).
  • Right-to-Left Associativity: Operators with right-to-left associativity are evaluated from right to left. Examples include unary operators (++ and -- when used as prefixes), the assignment operator (=), and the conditional operator (?:).

Examples:

Consider the following examples to illustrate operator associativity:

  1. Left-to-Right Associativity:
  2.         int a = 5, b = 10, c = 15;
            int result = a + b * c;
            / Operator precedence: '*' has higher precedence than '+'
            / Evaluation: b * c (evaluated first) → 10 * 15 = 150
            / Then: a + 150 → 5 + 150 = 155
            / Associativity does not affect this case as operators have different precedence.
        
  3. Right-to-Left Associativity:
  4.         int x = 5;
            int y = 10;
            int z = 15;
            x = y = z;
            / Assignment operator '=' has right-to-left associativity.
            / Evaluation: z → y = 15 → x = 15
        

Why Option 2 is FALSE:

The statement "All operators in C have associativity from right to left" is incorrect because only a subset of operators, such as assignment operators and unary operators (prefix), follow right-to-left associativity. Most operators, including arithmetic, comparison, and logical operators, follow left-to-right associativity. The distinction between precedence and associativity is essential for understanding how expressions are evaluated in C.

Additional Information

Analysis of Other Options:

Option 1: "The statement y = x + *p; sets y to the value of x added with the value pointed to by p."

This statement is TRUE. In the expression y = x + *p;, the value pointed to by p (using the dereference operator *) is added to the value of x, and the result is assigned to y. This operation correctly demonstrates the use of the dereference operator (*) to access the value stored at the memory location pointed to by the pointer p.

Option 3: "Assignment has lower precedence than comparison operator."

This statement is TRUE. In C, comparison operators (e.g., ==, !=, <, >) have higher precedence than the assignment operator (=). This means that in an expression containing both comparison and assignment operators, the comparison operators are evaluated first. For example:

    int a = 5;
    int b = 10;
    int result = a == b; / Comparison operator (==) is evaluated first.

Option 4: "int calender [31] [12] means that calender is an array of 31 arrays of 12 int elements each."

This statement is TRUE. The declaration int calender[31][12] defines a two-dimensional array in C, where calender consists of 31 arrays, each containing 12 integer elements. This type of array is commonly used to represent tabular data, such as a calendar where rows represent days and columns represent months.

Conclusion:

The FALSE statement is Option 2, as not all operators in C have associativity from right to left. Understanding operator precedence and associativity is essential for writing correct and efficient programs in C. Other options accurately describe valid concepts and operations in C programming.

Latest ISRO Technical Assistant Updates

Last updated on May 30, 2025

-> The ISRO Technical Assistant recruitment 2025 notification has been released at the official website. 

-> Candidates can apply for ISRO recruitment 2025 for Technical Assistant from June 4 to 18.

-> A total of 83 vacancies have been announced for the post of Technical Assistant.

-> The Selection process consists of a written test and a Skill test.

-> Candidates can also practice through ISRO Technical Assistant Electrical Test Series, ISRO Technical Assistant Electronics Test Series, and ISRO Technical Assistant Mechanical Test Series to improve their preparation and increase the chance of selection. 

Get Free Access Now
Hot Links: teen patti casino download teen patti real cash game teen patti download apk teen patti customer care number teen patti neta