Online Test for C

  1. What is variable in C?
    It is a name of the memory location
    It is used to store data
    It’s value can be changed during execution of program
    All of the above

  1. Who is father of C Language?
    Bjarne Stroustrup
    Dennis Ritchie
    James A. Gosling
    Dr. E.F. Codd


  1. Find Error/Output in follwing code:
  2.                                 
    struct
    
    {
      int si;
      double d;
      float cp;
    } s;
    void
    main ()
    {
      printf ("%d, %d, %d",  sizeof (s.si), sizeof (s.d), sizeof (s.cp));
    }
    6, 10, 8
    4, 8, 4
    2, 4, 4
    2, 8, 8

  1. Which of these assignments is invalid?
    short s = 48;
    float f = 4.3;
    double d = 4.3;
    int I = `1`;

  1. The maximum value that an integer constant can have varies from one compiler to another.
    True
    False

  1. Number of binary trees formed with 5 nodes are
    30
    36
    108
    42


  1. In which tree, for every node the height of its left subtree and right subtree differ almost by one?
    Binary search tree
    AVL tree
    Threaded Binary Tree
    Complete Binary Tree

  1. #define is known as preprocessor compiler directive.
    True
    False

  1. Which of the following is not an iterative statement?
    while
    do while
    switch
    for

  1. Find Error/Output in follwing code:
  2.                                 
    int main ()
    
    {
      int a[4] = { 25, 16 };
      printf ("%d %d", a[0] & a[1], a[1] | a[2]);
    }
    Syntax error because of invalid operator symbol
    25 16
    16 16
    Syntax error because of invalid array initialization

Post Your Question
Social Sharing
Search