You are on page 1of 4
Dat 7 Dharmsinh Desai University Faculty of Technology BE. Semester II-CE/IT/MH - inal Examination Subject: Computer Programming in C -8/6]2011, Wednesday SeatNo:_ STpitpe = 2208 Max Marks: 60 Section L Answer the Following: 10 Which of the following are not relational operators? 1 @> ®< == W< The first expression in a “for” loop is? 1 (a) the test expression. (b) the step value of the loop (©) value of the counter variable (é) None of the given State true or false and justify: The output of a[4] and 4{a] is same if “a” is declared as an array of $ elements What is the continue statement used for? \ (a) To continue to the next line of code. __(b) As an alternative to the else statement {@) To stop the current iteration and begin the next iteration from the beginning. __(4) None of the given Write a C statement using the ternary operator to find the largest of three numbers stored in integer variables a, 6 and c and store the final result in variable d. What will be output if you compile and execute the following C code? void main() int array{3)={5} int is for imOsis=2si++) printi("%d "arrayfi): i (a)5 garbage garbage (b)500 — (c)S null null (d)None of above “What will be printed as the result of the operation below: 2 main() { int x20.y=355 - printf(“%od%d" x.y) or Answer the Following Write aC program to find if'a given string i alphabetical order. Do not use the header file . palindrome or not. If it isa palindrome then rearrange it in Describe the rules of precedence and associativity for evaluating mathematical expressions in C, Distinguish between function definition and function declaration with example. oR Answer the Following Write a C program that computes and displays a table of factorials upto any given integer Will following C code work? If yes, what would be the output? If no then find errors and correct them, main() © static int print(*\nn=364 iffo>=1) mind; ) Differentiate between Counter controlled loops and Sentinel controlled loops. Answer the Following Write a program to print a triangle using digits of « number. Suppose the user enters the number 1234, following triangle should be displayed: 1234 234 34 4 The program should work for number having any length. (not only four as shown in above example.) 40 PTO Buywonog amp z9Msuy ‘uowup, pue ammanng :armnUaleiCl “ayduiexo yarn suououry jo Supeopiasc wrepdse, 10 10 8d 4 Qs Explain Overloading of functions with example. Differentiate: Structure and Union, oR Answer the Following Waite a C program that allows the usr to store any number of integers in a file “numbers xt”. Then it reads all Perea ces from this file and writes all odd numbers ina file “odd.txe" and all even numbers in file “evensant™. Describe any three string functions with their syntax. Explain: Pointer to a pointer and Self referential structure Section II Answer the Following What will be output if you will compile and execute the Following C code? void eall(int int.int); void main(){ int a=10; call(aattta); void call(int x,int yint 2){ printf("%d %d %al".X.y.2) @O10 ANU Ol2212 @one Explain: Dangling Pointer. A member in a structure is? (a) Variable in a structure, (b) Structure's datatype. (c) Pointer to a structure, (a) none of the above. ee -———_CU number of bytes the operand occupies. Distinguish between: (*m)[5] and "ml State the limitation of scanf function for reading strings. Answer the Following Define a sinueture to store following information about magazines: pte ear, Editor's name and price, Also write a program to read and displey this information, Explain the terms: extern, auto, feof, union. Write any four Bitwise operators with their functions, _ 10 10 Answer the Following Define a structure to store following information about magazines: Title, month, year, Editor’s name and price. Also write a program to read and display this information Explain the terms: extern, auto, feof, union. Write any four Bitwise operators with their functions OR Answer the Following Write a C program that reverses the elements of a given array using pointers. Explain the terms: register, static, felose, typedef, Explain the two types of Assignment operators. Answer the Following Write a C program that provides mathematical functions (+, using command line arguments, J) by taking 2 numbers and a symbol as input Describe methods of passing structures to a function. Write aC program to find a’ Fibonacei number where ‘n’ is entered by the user. OR Answer the following Write a C program that takes a shape (Circle, Square, Rectangle, or Triangle) as input from user and overloads function “area()” to find the area of that shape. Each overloaded function should take the required information as argument. Write a C program using pointers to determine the length of a character string entered by the user ‘What do you mean by prototype of a function? When and why is it needed? 2

You might also like