Model Paper C Programming (15 Question )


                                                   INFORMATION ASSISTANT 2018 
Paper -1

1. Which of the following is true about return type of functions in C?
A Functions can return any type
B Functions can return any type except array and functions
C Functions can return any type except array, functions and union
D Functions can return any type except array, functions, function pointer and union

2.#include <stdio.h>
int main()
{
  printf("%d", main); 
  return 0;
}
(A) Address of main function
(B) Compiler Error
(C) Runtime Error
(D) Random Value

3.#include <stdio.h>
    int main()
 {
    int (*ptr)(int ) = fun;
    (*ptr)(3);
    return 0;
  }

int fun(int n)
{
  for(;n > 0; n--)
    printf("IA 2018 ");
  return 0;
}

A IA 2018 IA 2018 IA 2018
B IA 2018 IA 2018
C Compiler Error
D Runtime Error



4.#include<stdio.h>
  void dynamic(int s, ...)
 {
    printf("%d ", s);
  }
 int main()
{
    dynamic(2, 4, 6, 8);
    dynamic(3, 6, 9);
    return 0;
}
(A) 2 3
(B) Compiler Error
(C) 4 3
(D) 3 2

5.include <stdio.h>
int main()
{
    void demo();
    void (*fun)();
    fun = demo;
    (*fun)();
    fun();
    return 0;
}
 void demo()
{
    printf("IA ");
}
A IA
B IA IA
C Compiler Error
D Blank Screen

6.#include<stdio.h>
int main()
{
  static int *i;
  int j;
  i  = &j;
  printf("%d", *i);
  return 0;
}
(A) Compiler Error
(B) Runtime Error
(C) junk Value
(D) 1

7.#include <stdio.h>
int fun()
{
  static int num = 16;
  return num--;
}

 int main()
{
  for(fun(); fun(); fun())
    printf("%d ", fun());
  return 0;
}
(A) Infinite loop
(B) 13 10 7 4 1
(C) 14 11 8 5 2
(D) 15 12 8 5 2

8.#include <stdio.h>
int main()
{
  int x = 10;
  static int y = x;
  
  if(x == y)
     printf("Equal");
  else if(x > y)
     printf("Greater");
  else
     printf("Less");
  return 0;
}
(A) Compiler Error
(B) Equal
(C) Greater
(D) less

. C, static storage class cannot be used with:
(A) Global variable
(B) Function parameter
(C) Function name
(D) Local variable

10.#include <stdio.h>
int main()
{
  register int i = 10;
  int *ptr = &i;
  printf("%d", *ptr);
  return 0;
}
(A) Prints 10 on all compilers
(B) May generate compiler Error
(C) Prints 0 on all compilers
(D) May generate runtime Error

11.#include <stdio.h>
int main()
{
  extern int i;
  printf("%d ", i);
  {
       int i = 10;
       printf("%d ", i);
  }
}
(A) 0 10
(B) Compiler Error
(C) 0 0
(D) 10 10

12. #include <stdio.h>
int fun()
{
    puts(" Hello ");
    return 10;
}

int main()
{
    printf("%d", sizeof(fun()));
    return 0;
}
(A)  2
(B) Hello 2
(C) 2 Hello
(D) Compiler Err     



13. #include <stdio.h>
int main()
{
  char arr[] = "IAC18Quiz";
  printf("%s", arr);
  return 0;
}
(A) arr
(B) compile error
(C) Run time error
(D) IAC18Quiz

Next - Paper 2     Paper 3 Increment / Decrements Operator

                                "Just Click Full Model Paper Information Assistant"
(1) b (2) b (3) c (4) a (5) c (6) c (7) c (8) a (9) b 10 b (11) b (12) 2 (13) D

No comments:

Post a Comment