Wednesday, October 1, 2014

2012-13 (EVEN SEM)

B.Tech.

(SEMESTER - II) EVEN SEMESTER THEORY EXAMINATION, 2012-13

COMPUTER PROGRAMMING

SECTION – A


1.      Attempt all parts of this section:                                                        (2 X 10 = 20)

a)      What do curly braces denote in C? Why does it make sense to use curly braces to surround the body of a function?
b)      The following lines of code, when arranged in the proper sequence, output the simple message “All your base are belong to us”:
                                                        i.            return 0;
                                                      ii.            const char msg[] = MSG1;
                                                    iii.            }
                                                    iv.            #define MSG1 “All your base are belong to us!”
                                                      v.            mt main(void) {
                                                    vi.            #include<stdio.h>
                                                  vii.            puts(msg);

c)      Convert each of the following octal numbers to decimal and hexadecimal formats:
                                                        i.            (3754)8
                                                      ii.            (7777)8

d)     What is the need of an operating system?
e)      Classify the OS into different types based on their processing capability.
f)       Differentiate the following:
                                                        i.            Unary operator and Binary operator
                                                      ii.            Local variable and Global variable
g)      What is the need of functions?
h)      What are escape sequence character?
i)        What is the need of dynamic memory allocation?
j)        Write down few commands available in /bin and /sbin directory.


SECTION –B

2. Attempt any three parts of this section. Each part carries 10 marks.         (10 X 3 = 30)

a)      Describe the generations of computer based on the (i) Hardware (ii) Software (iii) Computing characteristics (iv) Physical appearance and (v) Applications.
b)      What is a recursive function? What are its basic properties? Write a function which finds the sum of first n integers; where n is the argument to the function.
c)      Write a C program that accepts name and marks scored by students in five subjects. Use functions:

                                i.            ADD to add records with student names and marks to a file
                              ii.            CALCULATE to read the records from the file, calculate the result and display.   

d)     Write an algorithm for quick sort. Explain the working for sorting 35, 26, 10, 13, 45, 92, 30, 60.
e)       
                                i.            What is the difference between a zombie process and an orphan process?
                              ii.            What purpose do the functions getpid() and getppid() serve?
                            iii.            Explain Parent and Child processes in Linux with example.

SECTION – C

3. Attempt any two parts:                                                                   (5 X 2 = 10)
a)      Convert each of the following decimal numbers to binary, octal and hexadecimal formats:
                                i.            (3479)10
                              ii.            (555)10

b)      Draw a flowchart to play a dice game according to the following rules:
                                i.            If you throw two identical numbers, you win.
                              ii.            If the numbers are not the same, but are both even, or both odd, you have another turn.
                            iii.            If one number is odd, and the other is even, you lose.

c)      Differentiate between a Linker and Compiler.

4. Attempt any two parts:                                                                   (5 X 2 = 10)
a)      Differentiate between automatic variable, static variable and dynamic variable.
b)      Explain any two file operations and two bitwise operators with example.
c)      What are subscripts? How are they specified? What restrictions apply to the values that can be assigned to subscripts in “C” language?

5. Attempt any two parts:                                                                   (5 X 2 = 10)
a)      Write a program to construct a 3x3 matrix B that contains only the fractional part of another 3x3 matrix A that contains floating point numbers. Assume that elements of matrix A contain only two digit fractional numbers.
b)      What is the difference between call by value and call by reference? Write a program to swap two floating point numbers using call by reference method.
c)      Explain with example, the syntax and usage of the following in C program:
                                i.            Nested Structure Definition
                              ii.            Array of Structures

6. Attempt any two parts:                                                                   (5 X 2 = 10)
a)      A program in ‘C’ language contains the following declaration:
staticint x[8] = {1,2,3,4,5,6,7,8};
                                i.            What is the meaning of x?
                              ii.            What is the meaning of (x+2)?
                            iii.            What is the meaning of *x?
                            iv.            What is the meaning of (*x+2)?
                              v.            What is the meaning of *(x+2)?

b)      Differentiate the use of break and continue statements with an example.
c)      What is dynamic memory allocation? How does it help in building complex programs? What is the task of the following memory allocation functions?
                                i.            malloc
                              ii.            calloc

7. Attempt any two parts:                                                                   (5 X 2 = 10)
a)      Explain with example defining and calling macros and conditional compilation.
b)      Write a simple C program to show the use of string handling functions.
c)      Write a program to print out our array using the array notation and by dereferencing pointer.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.