COMPILER DESIGN

ADVANCED TOPICS IN COMPILER DESIGN

CODE GENERATION FOR OBJECT ORIENTED LANGUAGES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following data types is the best choice when declaring a variable that will be used to store a worker’s hourly wage and that will be used to calculate the worker’s total weekly earnings?
A
float
B
int
C
String
D
boolean
Explanation: 

Detailed explanation-1: -char. Keyword char is used for declaring character type variables.

Detailed explanation-2: -String (str or text) It is a sequence of characters and the most commonly used data type to store text.

Detailed explanation-3: -Structure. It is a data type that can store variables of similar or different data types. For example, we can use structures to store information about an employee, such as the employee’s name, employee ID, salary, and more.

Detailed explanation-4: -Answer. hrs = input("Enter Hours:") rate = input("Enter hourly rate:") h = float(hrs) r = float(rate) if h <= 40: print(h*r) else: print((h-40)*(1.5*r) + (40*r)); python.

There is 1 question to complete.