My Report

C Programming Practice Test 7


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

1. In linux, apart from including math header file, the program is successfully executed by which of the following?

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

    #include <stdio.h>
    #include <math.h>
    void main()
    {
        int k = pow(2, 3);
        printf("%d\n", k);
    } 

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

    #include <stdio.h>
    #include <math.h>
    int main()
    {
        unsigned int i = -1;
        printf("%f\n", fabs(i));
        return 0;
    } 

4. Which is the best way to generate numbers between 0 to 99?

5. What error will be generated on using incorrect specifier for the datatype being read?

6. In the below C program, every time program is run different numbers are generated.

    #include <stdio.h>
    #include <stdlib.h>
    int main()
    {
        printf("%d\n", rand());
        return 0;
    } 

7. What specifies the minimum number of characters to print after being padded with zeros or blank spaces?

8. What type of return-type used in String operations?

9. String operation such as strcat(s, t), strcmp(s, t), strcpy(s, t) and strlen(s) heavily rely upon.

10. What error is generated on placing an address operator with a variable in the printf statement?


 

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.