Aspire Faculty ID #13671 · Topic: JAMIA MILLIA ISLAMIA MCA 2023 · Just now
JAMIA MILLIA ISLAMIA MCA 2023

What is the data type of the following expression:  
expr₁ ? expr₂ : expr₃  
if expr₁ is of type float & expr₂ is of type int.

Solution

Solution: In the **ternary operator** `(expr₁ ? expr₂ : expr₃)`, the **data type of result** is the **common type** of `expr₂` and `expr₃`. Here, - `expr₁` → condition (float type, irrelevant for result type) - `expr₂` → int - `expr₃` → (not specified but implied same as expr₂ type logic) When int and float are combined → **result type = float** (implicit type conversion).

Previous 10 Questions — JAMIA MILLIA ISLAMIA MCA 2023

Nearest first

Next 10 Questions — JAMIA MILLIA ISLAMIA MCA 2023

Ascending by ID
Ask Your Question or Put Your Review.

loading...