C Questions


Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-content/plugins/quiz-maker/public/class-quiz-maker-public.php on line 1335

Deprecated: Implicit conversion from float 0.16666666666666666 to int loses precision in /home/u797631661/domains/codermantra.com/public_html/wp-content/plugins/quiz-maker/includes/class-quiz-maker-data.php on line 1008

Deprecated: Implicit conversion from float 0.16666666666666666 to int loses precision in /home/u797631661/domains/codermantra.com/public_html/wp-content/plugins/quiz-maker/includes/class-quiz-maker-data.php on line 1008

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449
0 votes, 0 avg
617

C Questions

1 / 15

1. Which of the following is true about return type of functions in C?

2 / 15

2. In C, parameters are always 

3 / 15

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

        #include 

        struct student

        {

            int no = 5;

            char name[20];

        };

        void main()

        {

            struct student s;

            s.no = 8;

            printf("hello");

        }

4 / 15

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

#include 

int main(){
    int i, j;

    for (i = 2; i < 10; i++) {
        for (j = 2; j <= (i / j); j++)
            if (!(i % j))
                break;
        if (j > (i / j))
            printf("%d ", i);
    }

    return 0;
}

5 / 15

5. What is the return type of the fopen() function in C?

6 / 15

6. What is the output of C Program.?

int main()
{
    int a=14;
    
    while(a<20)
    {
        ++a;
        if(a>=16 && a<=18)
        {
            continue;
        }
        printf("%d ", a);
       
    }

    return 0;
}

7 / 15

7. What is the default return type if it is not specified in function definition?

8 / 15

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

#include 

int main()
{
    float x = 23.456;
    printf("%.2f",x);
    return 0;
}

9 / 15

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

#include 

int main(){
    char grade = 'B';

    switch (grade) {
    case 'A':
        printf("Excellent!n");
    case 'B':
    case 'C':
        printf("Well donen");
    case 'D':
        printf("You passedn");
    case 'F':
        printf("Better try againn");
        break;
    default:
        printf("Invalid graden");
    }
}

10 / 15

10. What will be the output of this program?

    int main()      
    {      
    int a=10, b=20;        
    printf("a=%d b=%d",a,b);        
    a=a+b;      
    b=a-b;      
    a=a-b;      
    printf("a=%d b=%d",a,b);      
    return 0;    
    }     

11 / 15

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

        #include 

        void main()

        {

            int x = 1, y = 0, z = 5;

            int a = x && y && z++;

            printf("%d", z);

        }

12 / 15

12. What will be the output of the following code snippet?

#include 
void solve() {
    int ch = 2;
    switch(ch) {
        case 1: printf("1 ");
        case 2: printf("2 ");
        case 3: printf("3 ");
        default: printf("None");
    }
}
int main() {
    solve();
return 0;
}

13 / 15

13. What will be the output of the following C code considering the size of a short int is 2, char is 1 and int is 4 bytes?

        #include 

        int main()

        {

            short int i = 20;

            char c = 97;

            printf("%d, %d, %dn", sizeof(i), sizeof(c), sizeof(c + i));

            return 0;

        }

14 / 15

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

        #include 

        #include 

        void main()

        {

            int k = pow(2, 3);

            printf("%dn", k);

        }

15 / 15

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

        #include 

        void main()

        {

            double k = 0;

            for (k = 0.0; k < 3.0; k++)

                printf("Hello");

        }

Your score is

The average score is 39%

0%