Lab: Introduction to Computers Code: ENGR 103 Quiz [30 points]: Answer ALL Quest
ID: 3726284 • Letter: L
Question
Lab: Introduction to Computers Code: ENGR 103 Quiz [30 points]: Answer ALL Questions Instructor: Dr. Vidhyacharan Bhaskar Date: March 08, 2018 Time duration: 1 hour 30 min A. 1. 2. Say True or False [5 points] int main 01) is a complete and correct C program printf and main are C tokens The format specification for an int type data should not contain a decimal point and precision, 968.2d 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? 4· The condition gr(valid) means 5· The assignment statement a-b-c + d sunplifies to a. dogs2 a. year 1967; b. day 24 hours; a. 2s complement b. 1s complement c. negative of a number d. modulo two a. if (valid ,-0) b. if (!valid0) c. if (valid-0) d. if (!valid I-0) a. a-b+1c + d); b, a _ b + (b + c + d); e, a (b _ b + (c + d));da-b-(b=c+d) b. cat number c, pears-3 d, area% c. year - days 365 d. while- 32; C. Mateh the following Escape characters with their corresponding ASClU values given in hexadecima notation: [5 points] a. VTAB BELL 2. x22 1x22 3. "x9 c. BACKSLASH d. GARRIAGE RETURN e. FORMFEED f. BACKSPACE g. HTAB h. SINGLE QUOTES . DOUBLE QUOTES j. QUESTION MARK 6·1x3F. D. Find the syntax errors in the following piece of code fragments: [5 points] a. char msg-"warning: b, for (m 0, mExplanation / Answer
As per chegg answering guidelines I am answering first four sub parts of the given assignment.
A
1. TRUE
2. TRUE
3. TRUE(it must be %d format only)
4. FALSE(it displays 123)
5. TRUE
B.
1. d).area%(except "_" no other special char are allowed in identifiers)
2. d). while=32 (while is a keyword)
3. c).negative
4. c).if(valid != 0 )
5. b). a = b+(b+c+d)
C.
VTAB ''
BELL ''
BACKSLASH ''
CARRIAGE RETURN '
'
FORMFEED ''
BACKSPACE 'C'
HTAB ' '
SINGLE QUOTES '''
DOUBLE QUOTES '"'
QUESTION MARK '?'
D.
// I have commented the possible errors
// and corrections as comments below
#include<stdio.h>
int main() {
char msg = "warning"; //invalid conversion of char
for (m=0;m<n;m++;n--){ //m and n were undeclared
z = (a>b)?a;b; //it must be z = (a>b)?a:b;
while(c = getchar()!= )//while(c = getchar()!=" "
i=1;
do{
i = i*2;
i++;
}while(i<100)
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.