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. Which of the following operators is used to concatenate two strings without space?

Question 1 of 10

Question 2 of 10

2. Which of the following format specifiers is used to represent the hours in the 24 hour clock (0-23) format?

Question 2 of 10

Question 3 of 10

3. What will be the output of the following C code if the input entered as first and second number is 5 and 6 respectively?

#include<stdio.h>
#include<stdlib.h>
main()
{
    int *p;
    p=(int*)calloc(3*sizeof(int));
    printf("Enter first number\n");
    scanf("%d",p);
    printf("Enter second number\n");
    scanf("%d",p+2);
    printf("%d%d",*p,*(p+2));
    free(p);
}

Question 3 of 10

Question 4 of 10

4. The value of CHAR_MAX will be equal to SCHAR_MAX when _________

Question 4 of 10

Question 5 of 10

5. The standard byte order for networks is ____________

Question 5 of 10

Question 6 of 10

6. In the directive, #pragma pack(n), which of the following is not a valid value of n?

Question 6 of 10

Question 7 of 10

7. 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 7 of 10

Question 8 of 10

8. The library function clock() returns the number of _________ elapsed since the start of the program.

Question 8 of 10

Question 9 of 10

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

#include<time.h>
int main (void)
{
    float n = time(NULL);
    printf("%.2f\n" , n);
}

Question 9 of 10

Question 10 of 10

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

#define F abc
#define B def
#define FB(arg) #arg
#define FB1(arg) FB(arg)
main()
{
    printf(FB(F B));
    FB1(F B);
}

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.