In search of my DESTINY....!!!!

Thursday, 25 August 2016

On 11:59:00 by Unknown   No comments
1. What is the output of this C code?

void foo(const int *);
int main()
{
const int i = 10;
printf("%d ", i);
foo(&i);
printf("%d", i);
}
void foo(const int *i)
{
*i = 20;
}
  • A. Compile time error
  • B. 10    20
  • C. Undefined value
  • D. 10
  • 2. Comment on the output of this C code?

    int main()
    {
    const int i = 10;
    int *ptr = &i;
    *ptr = 20;
    printf("%d\n", i);
    return 0;
    }
    • A. Compile time error
    • B. Compile time warning and printf displays 20
    • C. Undefined behaviour
    • D. 10
    • 3. What is the output of this C code?

      int main()
      {
      j = 10;
      printf("%d\n", j++);
      return 0;
      }
      • A. 10
      • B. 11
      • C. Compile time error
      • D. 0

      4. Does this compile without error?

      int main()
      {
      for (int k = 0; k < 10; k++);
      return 0;
      }
      • A. Yes
      • B. No
      • C. Depends on the C standard implemented by compilers
      • D. None of the mentioned

      5. Does this compile without error?

      int main()
      {
      int k;
      {
      int k;
      for (k = 0; k < 10; k++);
      }
      }
      • A. Yes
      • B. No
      • C. Depends on the compiler
      • D. Depends on the C standard implemented by compilers
      • 6. Which of the following declaration is not supported by C?
        • A. String str;
        • B. char *str;
        • C. float str = 3e2;
        • D. Both (a) and (c)
        • 7. Which of the following format identifier can never be used for the variable var?

          int main()
          {
          char *var = "Advanced Training in C by AllIndiaExams.com";
          }
          • A. %f
          • B. %d
          • C. %c
          • D. %s
          • 8. Which of the following declaration is illegal?
            • A. char *str = “Best C programming classes by AllIndiaExams”;
            • B. char str[] = “Best C programming classes by AllIndiaExams”;
            • C. char str[20] = “Best C programming classes by AllIndiaExams”;
            • D. char[] str = “Best C programming classes by AllIndiaExams”;
            • 9. Which keyword is used to prevent any changes in the variable within a C program?
              • A. immutable
              • B. mutable
              • C. const
              • D. volatile
              • 10. Which of the following is not a pointer declaration?
                • A. char a[10];
                • B. char a[] = {’1', ’2', ’3', ’4'};
                • C. char *str;
                • D. char a;


On 07:30:00 by Unknown   No comments


1. What is the output of this C code?

int main()
{
enum {ORANGE = 12, MANGO, BANANA = 11, APPLE};
printf(
"APPLE = %d\n", APPLE);
}
A. APPLE= 11
B. APPLE= 12
C. APPLE= 23
D. APPLE= 0
2. What is the output of this C code?

int main()
{
printf(
"C programming %s", "Class by\n%s AllIndiaExams", "SUPER");
}
A. C programming Class by SUPER AllIndiaExams
B. C programming Class by\n%s AllIndiaExams
C. C programming Class by %s AllIndiaExams
D. Compilation error
3. For the following code snippet:
char *str = “AllIndiaExams.in\0? “training classes”;
The character pointer str holds reference to string:
A. AllIndiaExams.in
B. AllIndiaExams.in training classes
C. AllIndiaExams.in\0training classes
D. Syntax error
4. What is the output of this C code?

#define a 20
int main()
{
const int a = 50;
printf(
"a = %d\n", a);
}
A. a = 50
B. a = 20
C. Run time error
D. Compilation Error
5. What is the output of this C code?

int main()
{
int var = 010;
printf(
"%d"var);
}
A. 2
B. 8
C. 9
D. 10

6. enum types are processed by?
A. Compiler
B. Preprocessor
C. Linker
D. Assembler

7. What is the output of this C code?

int main()
{
printf(
"AllIndiaExams\r\nclass\n");
return 0;
}
A. AllIndiaExamsclass
B. AllIndiaExams
      class
C. classundry
D. AllIndiaExams

8. What is the output of this C code?

int main()
{
const int a;
a = 32;
printf(
"a is %d", a);
return 0;
}
A. a is 32
B. Compile time error
C. Run time error
D. none

9. Which is false?
A. Constant variables need not be defined as they are declared and can be defined later
B. Global constant variables are initialised to zero
C. const keyword is used to define constant values
D. You cannot reassign a value to a constant variable

10. Whats is the output of this C code?

void main()
{
int const k = 11;
k++;
printf(
"k is %d", k);
}
A. k is 12
B. Error because const and int are used together
C. garbage value
     D. Error, because a constant variable cannot be changed

11. Comment on the output of this C code?

int const print()
{
printf(
"AllIndiaExams.in");
return 0;
}
void main()
{
print();
}
    A. AllIndiaExams.in is printed infinite number of times
B. AllIndiaExams.in
C. Runtime Error
D. complilation error