Identify the datatype of expressions.

Q8. Given the following set if identifiers :

char ch;

short sh;

int intval;

long longval;

float fl;

Identify the datatype of the following expressions:

  1. ‘a’ – 2
  2. intval *longval – ch
  3. fl + longval / sh

Ans.(1). int because

‘a’ – 3

char   int

int

Ans.(2). long because

(intval * longval) – ch

int           long           char

long                     char

long

Ans.(3). float because

fl + (longval / sh)

float   long   short

float          long

float

Leave a Reply

Your email address will not be published. Required fields are marked *

112 Views
%d bloggers like this: