Constants


  1. What will be the output of the following C code?












  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    r is carriage return and moves the cursor back. Inter is replaced by Mania.


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    printf("Interview\r\nMania\n");
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    rn combination makes the cursor move to the next line.



  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    const int n;
    n = 12;
    printf("n is %d", n);
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Since the constant variable has to be declared and defined at the same time, not doing it results in an error.


  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    int n = 21;
    int *const m = &n;
    int s = 12;
    m = &s;
    printf("%d", m);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Since the pointer m is declared to be constant, trying to assign it with a new value results in an error.



  1. Which of the following statement is false?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Since the constant variable has to be declared and defined at the same time, not doing it results in an error.