Medha -the Programming Quiz

20 Questions | Total Attempts: 460

SettingsSettingsSettings
Please wait...
Medha -the Programming Quiz


Questions and Answers
  • 1. 
     What is the output of the below code snippet?#include<stdio.h> main(){   int a = 5, b = 3, c = 4;     printf("a = %d, b = %d\n", a, b, c);}
    • A. 

      a=5, b=3

    • B. 

      a=5, b=3,c=0

    • C. 

      a=5, b=3,0

    • D. 

      Compile error

  • 2. 
    What is the output of the following program?#include<stdio.h> main(){   struct { int x;} var = {5}, *p = &var;     printf("%d %d %d",var.x,p->x,(*p).x);}
    • A. 

      5 5 5

    • B. 

      5 5 garbage value

    • C. 

      5 5 0

    • D. 

      Compile error

  • 3. 
    What is the built in library function to adjust the allocated dynamic memory size.
    • A. 

      Malloc

    • B. 

      Calloc

    • C. 

      Realloc

    • D. 

      Resize

  • 4. 
    What is the output of the following program?#include<stdio.h>main(){ fprintf(stdout,"Hello, World!");}
    • A. 

      Hello, world!

    • B. 

      Compile error

    • C. 

      No output

    • D. 

      Runtime error

  • 5. 
    A Variable name in C includes which special symbols?
    • A. 

      * (asterisk)

    • B. 

      # (Hash)

    • C. 

      + (Addition)

    • D. 

      _ (underscore)

  • 6. 
    The correct order of mathematical operators in mathematics and computer programming,
    • A. 

      Addition, Subtraction, Multiplication, Division

    • B. 

      Division, Multiplication, Addition, Subtraction

    • C. 

      Multiplication, Addition, Division, Subtraction

    • D. 

      Mathematical operators can be done in any order

  • 7. 
    Choose the correct order of evaluation,
    • A. 

      Relational Arithmetic Logical Assignment

    • B. 

      Arithmetic Relational Logical Assignment

    • C. 

      Logical Arithmetic Relational Assignment

    • D. 

      Assignment Arithmetic Logical Relational

  • 8. 
     What is the output of the below code snippet?#include<stdio.h> main(){   for(;;)printf("Hello");}
    • A. 

      Infinite loop

    • B. 

      Prints “Hello” once.

    • C. 

      No output

    • D. 

      Compile error

  • 9. 
    Compiler generates ___ file.
    • A. 

      Executable code

    • B. 

      Object code

    • C. 

      Assembly code

    • D. 

      None of above

  • 10. 
    C is the successor of ___ programming language.
    • A. 

      C++

    • B. 

      B++

    • C. 

      B

    • D. 

      MINI C

  • 11. 
    Which library function can convert an integer/long to a string?
    • A. 

      ltoa()

    • B. 

      Ultoa()

    • C. 

      Sprintf()

    • D. 

      None of the above

  • 12. 
    What is the output of the following program?#include<stdio.h>void f(){ static int i = 3;    printf("%d ", i);   if(--i) f();}main(){ f();}
    • A. 

      3 2 1 0

    • B. 

      3 2 1

    • C. 

      3 3 3

    • D. 

      Compile error

  • 13. 
    Identify the incorrect file opening mode from the following.
    • A. 

      R

    • B. 

      W

    • C. 

      X

    • D. 

      A

  • 14. 
    In C, what are the various types of real data type (floating point data type)?
    • A. 

      Float, long double

    • B. 

      Long double, short int

    • C. 

      Float, double, long double

    • D. 

      Short int, double, long int, float

  • 15. 
    To print a double value which format specifier can be used?
    • A. 

      %L

    • B. 

      %If

    • C. 

      %Lf

    • D. 

      None of the above

  • 16. 
    What is the output of the following program?#include<stdio.h>void main(){   char s[ ] = "C++";    printf("%s ",s);   s++;   printf("%s",s);}
    • A. 

      C++ C++

    • B. 

      C++ ++

    • C. 

      ++ ++

    • D. 

      Compile error

  • 17. 
    Which of the following statement shows the correct implementation of nested conditional operation by finding greatest number out of three numbers?
    • A. 

      Max = a>b ? a>c?a:c:b>c?b:c

    • B. 

      A=b ? c=30;

    • C. 

      A>b : c=30 : c=40;

    • D. 

      Return (a>b)?(a:b) ?a:c:b

  • 18. 
    Specify the 2 library functions to dynamically allocate memory?
    • A. 

      Malloc() and memalloc()

    • B. 

      Alloc() and memalloc()

    • C. 

      Malloc() and calloc()

    • D. 

      Memalloc() and faralloc()

  • 19. 
    In C, if you pass an array as an argument to a function, what actually gets passed?
    • A. 

      Value of elements in array

    • B. 

      First element of the array

    • C. 

      Base address of the array

    • D. 

      Address of the last element of array

  • 20. 
    Which of the following function is used to find the first occurrence of a given string in another string?
    • A. 

      Strchr()

    • B. 

      Strrchr()

    • C. 

      Strstr()

    • D. 

      Strnset()

Back to Top Back to top