Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

de: ENGR T03 Date: March 08, 2018 Time duration: 1 hour iz [30 points]: Answer A

ID: 3726283 • Letter: D

Question

de: ENGR T03 Date: March 08, 2018 Time duration: 1 hour iz [30 points]: Answer ALL Questions A. Say True or False [5 points] 1. int main O () is a complete and correct C pro 2. printf and main are C tokens 3· The format specification for an int type data should not contain a decimal point and precision, %82d is illegal. 4· The statement printf ("%-3d", 123); displays-123 5The result of an integer division is a rounded result. B. Choose the best answers (more than one may be correct for some cases) : [5 points] 1. Which of the following are illegal identifiers? 2. Which of the following are incorrect C assignment statements? 3. The unary operator~does which of the following functions? dogs2 b. cat number c.pears 3 d.area% a. year= 1967; b. days 24 hours; c. year = days-365; d, while-32; . modulo two a. 2s complement b. 1s complement c. negative of a number d The condition ir(valid) means 4· b. if (!valid0) c. if (valid 0) d. if(!valid ! 0) if (valid != 0) 5. The assignment statement a a. b+c+ d simplifies to

Explanation / Answer

ANSWER 1: Yes it is correct and complete program because it contains main() function which is complete but empties it will run definitely.

ANSWER 2: Yes printf and main are the identifier in c.

ANSWER 3: If you use %8.2d then it will print int value after spacing 8 in the console, by this you can not print decimal values.

ANSWER 4: No It will print 123 only you cannot use like this.

ANSWER 5: YES it is true.

ANSWER (B)1: area% is illegal and rest are valid identifiers.

ANSWER (B) 2: here day= 24 hours is illegal because a gap in the 24 and hours and while=32 it is not valid because while is reserved keyword in c you can not use it as a variable.

ANSWER (B) 3: negative numbers are stored as the two's complement of the positive counterpart. so here option (a) is correct.

ANSWER (B) 4: Here option(C) if(valid==0) is correct.