C/C / Sample Test,Sample questions

Question:
 Is initialization mandatory for local static variables?

1.Yes

2.No

3.Depends on the compiler

4.Depends on the standard

Posted Date:-2022-03-21 05:17:10


Question:
 What linkage does automatic variables have?

1. Internal linkage

2.External linkage

3.No linkage

4.None of the mentioned

Posted Date:-2022-03-21 02:37:54


Question:
Array sizes are optional during array declaration by using ______ keyword.

1.auto

2.static

3.extern

4.register

Posted Date:-2022-03-21 04:58:11


Question:
Assignment statements assigning value to local static variables are executed only once?

1.true

2.False

3.Depends on the code

4.None of the mentioned

Posted Date:-2022-03-21 05:13:47


Question:
Automatic variables are allocated memory in?

1. heap

2.Data segment

3.Code segment

4.stack

Posted Date:-2022-03-21 03:12:59


Question:
Automatic variables are initialized to?

1.0

2.Junk value

3.Nothing

4.Both (a) & (b)

Posted Date:-2022-03-21 04:34:38


Question:
Automatic variables are variables that are?

1.Declared within the scope of a block, usually a function

2.Declared outside all functions

3.Declared with auto keyword

4.Declared within the keyword extern

Posted Date:-2022-03-21 02:39:33


Question:
Automatic variables:

1.Exist only within that scope in which it is declared

2.Cease to exist after the block is exited

3. Both (a) & (b)

4.Only 1

Posted Date:-2022-03-21 03:12:05


Question:
Functions have static qualifier for its declaration by default.

1.True

2.False

3.Depends on the compiler

4.Depends on the standard

Posted Date:-2022-03-21 05:15:14


Question:
The variable declaration with no storage class specified is by default:

1.auto

2.extern

3.static

4.register

Posted Date:-2022-03-21 04:45:25


Question:
What is the format identifier for "static a = 20.5;?

1.%s

2. %d

3.%f

4. Illegal declaration due to absence of data type

Posted Date:-2022-03-21 05:14:29


Question:
What is the output of this C code?

    int x = 5;
    void main()
    {
        int x = 3;
        m();
        printf("%d", x);
    }
    void m()
    {
        x = 8;
        n();
    }
    void n()
    {
        printf("%d", x);
    }

1.8 3

2.8 5

3.3 8

4. 5 3

Posted Date:-2022-03-21 05:00:13


Question:
What is the output of this C code?

    int x = 5;
    void main()
    {
        int x = 3;
        printf("%d", x);
        {
            x = 4;
        }
        printf("%d", x);
    }

1.Run time error

2.3 3

3.3 5

4.3 4

Posted Date:-2022-03-21 04:48:03


Question:
What is the output of this C code?

    static int x;
    void main()
    {
        int x;
        printf("x is %d", x);
    }

1.0

2.Junk value

3.Run time error

4.Nothing

Posted Date:-2022-03-21 05:02:41


Question:
What is the output of this C code?

    void main()
    {
        int x = 3;
        {
            x = 4;
            printf("%d", x);
        }
    }

1.4

2.3

3.0

4.Undefined

Posted Date:-2022-03-21 04:58:56


Question:
What is the output of this C code?

    void main()
    {
        int x;
    }

 here x is?

1. automatic variable

2.static variable

3.global variable

4.register variable

Posted Date:-2022-03-21 03:14:34


Question:
What is the output of this C code?

    void main()
    {
        static int x;
        if (x++ < 2)
        main();
    }

1. Infinite calls to main

2.Run time error

3.Varies

4.main is called twice

Posted Date:-2022-03-21 05:04:38


Question:
What is the scope of a function?

1.Whole source file in which it is defined

2.From the point of declaration to the end of the file in which it is defined

3.Any source file in a program

4. From the point of declaration to the end of the file being compiled

Posted Date:-2022-03-21 04:56:31


Question:
What is the scope of an external variable?

1.Whole source file in which it is definedB.

2. From the point of declaration to the end of the file in which it is defined

3.Any source file in a program

4.From the point of declaration to the end of the file being compiled

Posted Date:-2022-03-21 04:49:34


Question:
Which of the following is true for static variable?

1. It can be called from another function

2.It exists even after the function ends.

3. It can be modified in another function by sending it as a parameter.

4.All of the mentioned

Posted Date:-2022-03-21 05:05:47


Question:
Which variable has the longest scope?

    int b;
    int main()
    {
        int c;
        return 0;
    }
    int a;

1.a

2.b

3.c

4.Both (a) and (b)

Posted Date:-2022-03-21 04:57:16


More MCQS

  1. help4info.com
  2. help4info.com
  3. help4info.com
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!