Skip to content
Related Articles

Related Articles

AKTU 1st Year Sem 1 Solved Paper 2017-18 | COMP. SYSTEM & C PROGRAMMING | Sec A

View Discussion
Improve Article
Save Article
Like Article
  • Difficulty Level : Basic
  • Last Updated : 30 Jan, 2019

Paper download link: Paper | Sem 1 | 2017-18


Time: 3hrs
Total Marks: 100


  • There are three sections. Section A carries 20 marks, Section B carries 30 marks and Section C carries 50 marks.
  • Attempt all questions. Marks are indicated against each question.
  • Assume suitable data wherever necessary.

Section – A

1. Attempt all parts: (2*10 = 20)

  1. Why do we use do-while loop in C? Also, tell any properties which you know?

    The do-while loop, in C, is used in the following cases:

    • When the body of the loop is to be executed at least once. For example, while writing a menu-driven program, where the menu is to be shown at least once.
    • When the loop is to be Exit-Controlled. For Entry-controlled loop, for and while loops are preferred.

    The properties of a do-while loop are:

    • The do-while loop is post tested or exit tested.
    • The body of the do-while loop is executed atleast once.
    • The condition checking is done at the end of the execution of the loop body.
  2. What is the meaning of break and continue keyword in C? Explain.

    Break: Break keyword is a jump statement which is used to terminate the loop or switch-case. As soon as the break keyword is encountered from within a loop or switch-case, the execution stops there and control returns from that point immediately to the first statement after the loop or switch.



    Continue: Continue is also a jump statement just like the break keyword. Continue keyword is opposite to that of break keyword. Instead of terminating the loop, it forces to execute the next iteration of the loop. When the continue statement is executed in the loop, the code inside the loop following the continue statement will be skipped and next iteration of the loop will begin.


  3. Define the concept of Modular programming approach?
    Modular programming is the process of subdividing a computer program into separate sub-programs. A module is a separate software component. It can often be used in a variety of applications and functions with other components of the system.

    • Some programs might have thousands or millions of lines and to manage such programs it becomes quite difficult as there might be too many of syntax errors or logical errors present in the program, so to manage such type of programs concept of modular programming approached.
    • Each sub-module contains something necessary to execute only one aspect of the desired functionality.
    • Modular programming emphasis on breaking of large programs into small problems to increase the maintainability, readability of the code and to make the program handy to make any changes in future or to correct the errors.
  4. Explain the difference between function definition and function declaration.
    Function declaration: Declaration of a function is for informing to the compiler the following information:

    • name of the function,
    • type and number of values it takes as arguments
    • return type of the function

    Therefore declaration gives details about the properties of a function. In this the function declaration has a semi-colon ‘;’ at the end.


    return_type function_name(arguments);


    int function1(int);
    char function2(int);
    void function3();

    Function Definition: Definition of a function is the segment where the body of the function is defined. The body of the function includes the details about the operations performed in this function. After the operations, it also includes the return statement, if any.


    return_type function_name(arguments)
        body of the function


    void function1(int x)
        printf("%d", x);
  5. Design a FlowChart and Algorithm to find the greatest number among three numbers.

    Algorithm to find the largest of three numbers:

    1. Start
    2. Read the three numbers to be compared, as A, B and C.
    3. Check if A is greater than B.
      3.1 If true, then check if A is greater than C.
        3.1.1 If true, print 'A' as the greatest number.
        3.1.2 If false, print 'C' as the greatest number.
      3.2 If false, then check if B is greater than C.
        3.1.1 If true, print 'B' as the greatest number.
        3.1.2 If false, print 'C' as the greatest number.
    4. End

    FlowChart to find the largest of three numbers:

  6. What is operator? Also define atleast three operators with example.
    Operators are the foundation of any programming language. We can define operators as symbols that help us to perform specific mathematical and logical computations on operands. In other words, we can say that an operator operates the operands.

    For example, consider the below statement:

    c = a + b;

    Here, ‘+’ is the operator known as addition operator and ‘a’ and ‘b’ are operands. The addition operator tells the compiler to add both of the operands ‘a’ and ‘b’.

    C/C++ has many built-in operator types and they can be classified as:

    • Arithmetic Operators: These are the operators used to perform arithmetic/mathematical operations on operands. Examples: (+, -, *, /, %, ++, –).


      int sum = 10 + 20;
    • Relational Operators: Relational operators are used for comparison of the values of two operands. For example: checking if one operand is equal to the other operand or not, an operand is greater than the other operand or not etc. Some of the relational operators are (==, >=, <= ).


      if(10 == 20)
           {    }
    • Assignment Operators: Assignment operators are used to assign value to a variable. The left side operand of the assignment operator is a variable and right side operand of the assignment operator is a value. The value on the right side must be of the same data-type of variable on the left side otherwise the compiler will raise an error.


      int a = 10;
  7. What will be the output of the below program?

        int a = 300, b, c;
        if (a >= 400)
            b = 300;
        c = 200;
        printf("\n%d %d", b, c);

    Output of the above program:

    32765 200

    Explanation: As value of a = 300 which is not (>= 400), therefore the if condition yields a false and the statement ‘b = 300;’ gets skipped. As a result, the value left in b is just a ‘garbage value’.
    But the statement ‘c = 200;’ is outside the loop. Therefore it gets executed no matter what. So the value of ‘c’ becomes ‘200’.
    Hence the output is ‘a_garbage_value 200’.

  8. What will be the output of the below program?

    #define PRODUCT(n) n* n
    void main()
        int j;
        j = 64 / PRODUCT(4);
        printf("%d", j);

    Output of the above program:


    Explanation: As ‘PRODUCT’ is a Macro, therefore the value of ‘PRODUCT(4)’ is replaced by the definition of ‘PRODUCT’ i.e. ‘n*n’. Threrefore, the evaluation occurs as follows:

        j = 64/PRODUCT(4);
          = 64 / 4 * 4;
          = 16 * 4;
        j = 64;
  9. Write a function to interchange the two values of two variables without using a third variable.
    The required program is:

    // C program to swap two values
    // without using a third variable
    #include <stdio.h>
    // Function to swap two numbers
    // without using a third variable
    void swap(int* xp, int* yp)
        // x now becomes 15
        *xp = *xp ^ *yp;
        // y becomes 10
        *yp = *xp ^ *yp;
        // x becomes 5
        *xp = *xp ^ *yp;
    // Driver code
    int main()
        int x = 10, y = 5;
        // swap the values
        swap(&x, &y);
        // Print the swapped values
        printf("After Swapping: x = %d, y = %d", x, y);
        return 0;

  10. What is the difference between the following two #include directives:

    • #include “filename”
    • #include

    When we use include directive, the contents of included header file (after preprocessing) are copied to the current file.
    Angular brackets < and > instruct the preprocessor to look in the standard folder where all header files are held. Double quotes “ and “ instruct the preprocessor to look into the current folder (current directory).

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!