C/C /C%20Multiple%20Choice%20Questions%20%20C%20Functions%20Set%202 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 12: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 09: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 11: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 12:13:47


Question:
Automatic variables are allocated memory in?

1. heap

2.Data segment

3.Code segment

4.stack

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


Question:
Automatic variables are initialized to?

1.0

2.Junk value

3.Nothing

4.Both (a) & (b)

Posted Date:-2022-03-21 11: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 09: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 10: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 12: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 11: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 12: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 12: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 11: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 12: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 11: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 10: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 12: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 11: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 11: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 12: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 11:57:16


More MCQS

  1. C++ Programming MCQS Set-1
  2. C++ Multiple Choice Questions Set-1
  3. C++ Multiple Choice Questions Set-2
  4. C++ Programming MCQS Set-2
  5. C++ Programming MCQS Set-3
  6. C++ Programming MCQS Set-4
  7. C++ (CPP) MCQ Question with Answer
  8. Advanced c++ multiple choice question(MCQS)
  9. OOPS Quiz Questions and Answers(MCQS)
  10. C Programming - MCQ Questions Set 1
  11. C Programming - MCQ Questions Set 2
  12. C Programming - MCQ Questions Set 3
  13. C Programming - MCQ Questions Set 4
  14. C Programming - MCQ Questions Set 5
  15. C++ programming language MCQ Questions Set 1
  16. C++ programming language MCQ Questions Set 2
  17. C++ programming language MCQ Questions Set 3
  18. C++ programming language MCQ Questions Set 4
  19. C++ programming language MCQ Questions Set 5
  20. C++ Programming -Constructors and Destructors
  21. C++ Programming -OOPS Concepts
  22. C++ Programming - References
  23. C++ Programming - Functions
  24. C MCQS:-The ABC of C
  25. C MCQS Interview Questions
  26. C++ Questions and Answers OOPs Basic Concepts
  27. C++ Questions and Answers Returning Objects
  28. C Programming MCQ Part 1
  29. C Programming MCQ
  30. Computer Science & Engineering C Multiple Choice Questions set 1
  31. Computer Science & Engineering C Multiple Choice Questions set 2
  32. C Multiple Choice Questions C Functions Set 1
  33. C Multiple Choice Questions C Functions Set 2
  34. C Multiple Choice Questions C Operators
  35. C Multiple Choice Questions & AnswersConditional Expressions
  36. C Multiple Choice Questions & Answers Data Types
  37. C Multiple Choice Questions & Answers File Access
  38. Computer Science & Engineering Cloud Computing MCQs Part 1
  39. CPP Programming MCQ Set 1
  40. CPP Programming MCQ Set 2
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!