NORTHERN INDIA ENGINEERING COLLEGE INTRODUCTION TO PROGRAMMING IN ‘C’ (1st Sem) ASSIGNMENT NO - 1 PART-A 1. What is number system? Explain decimal & binary number system. 2. What are complements? What is the significance of 2's complement in binary arithmetic? 3. How do we represent signed number? Explain. 4. How do we represent characters in computer? 5. Give example of Decimal to Binary, Octal, Hexadecimal Conversion. 1. 2. 3. 4. PART-B What is an algorithm? What are the characteristics of algorithm? What is a Flowchart? What are the advantages of flowchart over algorithm? Explain various components used for drawing a flowchart. Draw flowchart & write algorithm for the following a) To Find roots of a quadratic equation. b) To check whether given nos. is prime or not c) Greatest of 3 numbers. d) Sum of N numbers. e) To Find factorial of a number. f) To generate First N terms of Fibonacci series. g) To reverse an integer. h) To sum digits of an integer to a single digit. 5. What is DFD (Data Flow Diagram)? How it differs from flowchat. Give example of context diagram and Level 0 DFD. 6. What is Vi editor ? Define 2 modes of Vi editor. Give basic Vi editor commands? NORTHERN INDIA ENGINEERING COLLEGE INTRODUCTION TO PROGRAMMING IN ‘C’ (1st Sem) ASSIGNMENT NO -2 1. What is an expression? What are its components? 2. What is an operand? What is the relationship between operators and operands? 3. Describe the 5 arithmetic operators in C. Summarize the rules associated with their use. 4. How can the value of an expression be converted to a different data type? What is this called? 5. What is meant by operator precedence? What is meant by associatively? 6. When should parentheses be included within an expression? 7. What are unary operators? How many operands are associated with a unary operator? 8. Describe two different ways to utilize the increment and decrement operators? How do the two methods differ? 9. How can the nos. of bytes allocated to each data type be determined for a C compiler? 10. Descibe the 4 relational operators included in C. With what type of operands can they be used? What types of expression is obtained? 11. Describe two equality operators, 2 logical operators included in C. What is the purpose of each? 12. Describe the 6 assignment operators. How can multiple assignments be written in C? In what order will the assignments be carried out? 13 Describe the use of conditional operator to form conditional expressions. How is a conditional expression evaluated? 14 Are the library functions actually a part of the C language? Explain. 15 In what general category do the #deine and #include statements fall? 16 Suppose a, b and c are integer variables that have been assigned the values a=8, b=3 and c=-5. Determine the value of each of the following arithmetic expressions. a*b/c a) 2 * b + 3 * (a - c) b) (a * c) % b c) a*(b/c) d) e) a * (c % b) 17 A C program contains the following declarations: int i, j; long ix; short s; float x; double dx; char c; Determine the data type of each of the following expressions. a) ix+j b) dx + x c) s+c d) ((int) dx) + ix e) ix + c 18. A C program contains the following declarations and initial assignments: int i = 8, j = 5; float x = 0.005, y = -0.01; char c = 'c\ d = 'd'; Determine the value of each of the following expressions. Use the values initially assigned to the variables for each expression. a) (3 * i-2*j)%(2* d-c) b) 2 * ((i / 5 ) + (4 * (j 3))%(i+j-2)) c) (i-3 *j)%(c + 2* d)/(x y) d) (2 * x + y) = = 0 e) 2 * x + (y = = 0) f) 2 *x + y = = 0 g) !(i<=j) h) (i > 0) && (j < 5) i) (i >0)!! 0<5) J) (x>y)&&(i>0) !! (j <5) k) (x > y) && (i > 0) && (j < 5)