My Report

C Programming Mock Test 10


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement
 10%

Question 1 of 10

1. In the function malloc(), each byte of allocated space is initialized to zero.

Question 1 of 10

Question 2 of 10

2. What will be the output of the following C code?

#include<stdio.h>
#include<limits.h>
main()
{
    printf("%f",FLT_MIN);
}

Question 2 of 10

Question 3 of 10

3. What will be the output of the following C code?

#include <stdio.h>
#define sanfoundry(x)  #x
int main()
{
    int marks=100;
    printf("value of %s is = %d\n",sanfoundry(marks),marks);
    return 0;
}

Question 3 of 10

Question 4 of 10

4. What will be the output of the following C code?

Maximum value of int  =  1000
Maximum value of float = 5000
Maximum value of short int = 327
Minimum value of short int = -328
#include<stdio.h>
#include<limits.h>
#include<float.h>
main()
{
    short int d;
    d=INT_MAX + FLT_MAX;
    printf("%d",d);
}

Question 4 of 10

Question 5 of 10

5. The following C code results in an error.

#include <stdio.h>
#define world( n ) printf( "t^^" #n" = %c", t##n )
int t3=1;
int main()
{
   world(3);
}

Question 5 of 10

Question 6 of 10

6. Given that the value of SHRT_MAX is equal to 32767 and that of SHRT_MIN is equal to -32768, What will be the output of the following C code?

#include<stdio.h>
#include<limits.h>
main()
{
    int d;
    d=SHRT_MAX + SHRT_MIN+1;
    printf("%d",d);
}

Question 6 of 10

Question 7 of 10

7. How many times is ‘a’ printed when the following C code is executed?

#include<stdio.h>
main()
{
    int a;
    a=f1(10);
    printf("%d",a);
}
f1(int b)
{
    if(b==0)
        return 0;
    else
    {
        printf("a");
        f1(b--);
    }
}

Question 7 of 10

Question 8 of 10

8. What will be the output of the following C code?

#include<stdio.h>
extern inline int min(int a, int b) 
{
  return a < b ? a : b;
}
main()
{
    int m;
    m=min(3,-5);
    printf("%d",m);
}

Question 8 of 10

Question 9 of 10

9. The type of linked list in which the node does not contain any pointer or reference to the previous node is _____________

Question 9 of 10

Question 10 of 10

10. What will be the output of the following C code?

#include 
#define p( n,m ) printf( "%d", m##n )
#define q(a,b) printf("%d",a##b)
main()
{
   p(3,4);
   q(5,6);
}

Question 10 of 10


 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.