Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

1. What is the output of this C code?

  1.     #include <stdio.h>
  2.     double i;
  3.     int main()
  4.     {
  5.        printf("%gn",i);
  6.        return 0;
  7.     }

a) 0
b) 0.000000
c) Garbage value
d) Depends on the compiler

View Answer

Answer: a [Reason:] None.

2. Which part of the program address space is p stored in the code given below?

  1.     #include <stdio.h>
  2.     int *p = NULL;
  3.     int main()
  4.     {
  5.         int i = 0;
  6.         p = &i;
  7.         return 0;
  8.     }

a) Code/text segment
b) Data segment
c) Bss segment
d) Stack

View Answer

Answer: b [Reason:] None.

3. Which part of the program address space is p stored in the code given below?

  1.     #include <stdio.h>
  2.     int *p;
  3.     int main()
  4.     {
  5.         int i = 0;
  6.         p = &i;
  7.         return 0;
  8.     }

a) Code/text segment
b) Data segment
c) Bss segment
d) Stack

View Answer

Answer: c [Reason:] None.

4. Can variable i be accessed by functions in another source file?

  1.     #include <stdio.h>
  2.     int i;
  3.     int main()
  4.     {
  5.         printf("%dn", i);
  6.     }

a) 0
b) false
c) Only if static keyword is used
d) Depends on the type of the variable

View Answer

Answer: a [Reason:] None.

5. Property of external variable to be accessed by any source file is called by C90 standard as
a) external linkage
b) external scope
c) global scope
d) global linkage

View Answer

Answer: a [Reason:] None.

6. What is the output of this C code?

  1.     #include <stdio.h>
  2.     int *i;
  3.     int main()
  4.     {
  5.         if (i == NULL)
  6.             printf("truen");
  7.         return 0;
  8.     }

a) true
b) true only if NULL value is 0
c) Compile time error
d) Nothing

View Answer

Answer: a [Reason:] None.

7. What is the output of this C code?

  1.     #include <stdio.h>
  2.     int *i;
  3.     int main()
  4.     {
  5.         if (i == 0)
  6.             printf("truen");
  7.         return 0;
  8.     }

a) true
b) true only if NULL value is 0
c) Compile time error
d) Nothing

View Answer

Answer: b [Reason:] None.

8. What is the output of this C code?

  1.     #include <stdio.h>
  2.     static int x = 5;
  3.     void main()
  4.     {
  5.         x = 9;
  6.         {
  7.             int x = 4;
  8.         }
  9.         printf("%d", x);
  10.     }

a) 9
b) 4
c) 5
d) 0

View Answer

Answer: a [Reason:] None.