You are on page 1of 3
Nirma University Institute of Technology Semester End Examination (RPR), December - 2017 B.Tech. in CL / CH / ME / EE / IC / EC, ‘Semester-Prerequisite Courses CE102 Essentials of Programming Supervisor's initials With date ‘Max. Marks: 100 Instructions: 1. Attempt all questions. 2, Rigures to right indicate full marks. 3. Draw neat sketches wherever necessary. 4, Assume necessary data wherever required. Q-1 Answer the following. 1s] ‘A Fill in the Blanks. (06) 1. A for loop with no test condition is known as Loop. 2. (123)0= ( Yas 3. The ______ statement is used to skip a part of the statement in a loop. 4. An Array that uses more than two subscript is referred to as array. 5. The __ header file contains the mathematical functions. 6. The expression !(x!=y) can be replaced by ________ expression. B Discuss the basic structure of C program using an appropriate example. (06) C Draw a flowchart for “do-while” loop. (06) OR © Draw a flowchart for finding factorial of a given number. (06) Q-2 Answer the following. [16] ‘A. What do you understand by operators? Explain the use of the following (04) rators: 1. Relational 2. logical AND. B What is typecasting? When should a typecast be used? Discuss with an (06) example. © Design a C program to display prime numbers between 1 and 50. (06) OR © A pharmaceutical company provides solution to complete a chemical (06) process. Time and resources taken by chemical process depend on set of Chemical compounds as an input conditions. Company charges on the following basis: + If number of hours required to complete chemical process is Jess or equal to 48 then rates are rupees 2k per hour, If number of hours are more than 48 and less than 240, then the rates are up to 48 hours as serial number 1. For all the remaining rate is fixed at rupees 4Ix per hours. Lof3 Qs A B e poaow wp (CH102 - ESSENTIAL OF PROGRAMMING + Ifnumber of hours are more than 240, then the rates are upto 240 hours as per serial number 2. For all remaining rate is fixed at rupees 10k per hour. Write a C program to automate the above process. Answer the following. Differentiate between “entry controlled loop” and “exit controlled loop” with help of C program. Explain goto statement with an example, State advantages and disadvantages of goto statement Write a C program to print the following pattern using a concept of loop. 1 o1 101 0101 10101 Answer the following. ‘State whether each of the following statements is TRUE or FALSE with ‘proper justification: 1. An assignment statement includes = = symbol. 2. In language, an array starts from the position zero. 3. scanf() function can be used to read values through keyboard. Write a program to arrange all the elements of an array in ascending order. OR Write a program to find the frequency of characters from entered String. (Hint: frequency is how many times the character is repeated in the string) Discuss any four string handling functions with an appropriate example. Answer the following. Define a structure called as student that will describe the information as student name, student roll number and student's marks in three subjects. Using student, write a C program to read the information and display information of n students. Where n indicates the number of students. Discuss the scope and lifetime of a variable. Differentiate between structure and union in terms of memory location. Answer the following. What do you understand by recursion? Explain with example. OR Explain the various types of function calls in C. Write the output after correcting error (if any) of the following code snippets, and justify the same: (Assume the header files are included) Ae 2. #include int main()( int main() int a=7,b; { b= Hatatt++att+ +a; unsigned int i = 65536; printi(‘a=%d b=%d",a,b); /* Assume 2 byte integer*/ } while(i != 0) printi("%q" ++i); printf("\n"); return 0; 20f3 [16] (04) (06) 18] (03) (07) (07) (08) Ls] (06) (06) (06) (4) (06) (06) (08) a int main() f int a= 500, b = 100, ¢ if{la >= 400) b= 300; © = 200; printf(’b = %d c = %d\n", b, o); return 0; (CB102 - ESSENTIAL OF PROGRAMMING a int main() t int a[2|{a]= (1, 2, 9, 4, inti=0,j=0; for (i= 0; i < 2; i++) for (j= 0; j < 3; j++) printi(%d "alli 30f3

You might also like