Giter VIP home page Giter VIP logo

cognito-c's Introduction

Hello, sunshine☀️! How are you? Oh, your rays are already making my day brighter🌈!

I am Swasthik Shetty 👨🏻‍💻; A seasoned developer and designer. Loves to learn and explore new technologies and share the knowledge back to the community. I love to contribute and talk about the open-source while spending most of my time designing or on GitHub :octocat:.

I am a full time Cloud Solution Engineer at Google soving real world problems everyday. I am a GitHub Campus Expert 🚩; Microsoft Learn Student Ambassador, Lead of Hack Club Sahyadri , President of CodeChef SCEM Chapter, Developer at Codezoned 💻 , Technical Head of Sahyadri Open-Source Community and Community Member of Google Developer Student Club and Mozilla Club Sahyadri🔰

Looking for Internship 👀

portfolio     Linkedin     Twitter     gmail    

cognito-c's People

Contributors

chethanpoojary8176 avatar sharansk792000 avatar sumanthks20 avatar swaaz avatar

Watchers

 avatar

cognito-c's Issues

Bug in the quiz()

Describe the bug
There is an error in the quiz part, the error is in if() condition, it shows int value cannot be compared with structure.

To Reproduce
Steps to reproduce the behavior:
we need to replace q2.1 by q2.q[1]

Proper syntax

int main() //constants
{   system("clear");
        int x;

   l3_1: printf("\n\n1. What is the output of this C code?\n1. #include\n2. int main()\n3. {\n4. enum {ORANGE = 5, MANGO, BANANA = 4, PEACH};\n5. printf(\"PEACH=%d\",PEACH)\;\n6. }\n");
        printf("options\n1. PEACH = 3\n2. PEACH = 4\n3. PEACH = 5\n4. PEACH = 6 \n");
        printf("Enter the choice : ");
        scanf("%d",&x);
        if(x==q3.q[0])
        {
            printf("Correct\n");
            goto l3_2;
        }
        else
        {
            printf("Wrong\n");
            goto l3_1;  
        }
    l3_2:  printf("\n\n2. What is the output of this C code?\n1. #include\n2. int main() \n3. { \n4. printf(\"C programming %%s\", \"Class by %%s Sanfoundry\",\"WOW\")\;\n5. }  \n\nOptions\n1. C programming Class by WOW Sanfoundry \n2. C programming Class by %%s Sanfoundry\n3. C programming Class by %%s Sanfoundry\n4. Compilation error \n");
        printf("Enter the choice : ");
        scanf("%d",&x);
        if(x==q3.q[1])
        {
            printf("Correct\n");
            goto l3_3;
        }
        else
        {
            printf("wrong\n");
            goto l3_2;
        }
    l3_3:  printf("\n\n3. For the following code snippet:\nchar *str = \“Sanfoundry.com\\0\” \“training classes\”\; \nThe character pointer str holds reference to string: \n");
           printf("options \n1. Sanfoundry.com\n2. Sanfoundry.com\0training classes\n3. Sanfoundry.comtraining classes\n4. Invalid declaration\n");
        printf("Enter the choice : ");
        scanf("%d",&x);
        if(x==q3.q[2])
        {
            printf("Correct\n");
            goto l3_4;
        }
        else
        {
            printf("wrong\n");
            goto l3_3;
        }
    l3_4:  printf("\n\n4. What is the output of this C code?\n1. #include\n2. #define a 10\n3. int main()\n4. {\n5. const int a = 5;\n6. printf(\"a = %d\", a)\;\n7. }\n ");
            printf("options\n1. a = 5\n2. a = 10\n3. Compilation error\n4. Runtime error\n");
        printf("Enter the choice : ");
        scanf("%d",&x);
        if(x==q3.q[3])
        {
            printf("Correct\n");
            goto l3_5;
        }
        else
        {
            printf("wrong\n");
            goto l3_4;
        }
    l3_5:  printf("\n\n5. What is the output of this C code?\n1. #include\n2. int main()\n3. {\n4. int var = 010;\n5. printf(\"%d\", var)\;\n6. }\n");
            printf("options\n1. 2\n2. 8\n3. 9 \n4. 10\n");
        printf("Enter the choice : ");
        scanf("%d",&x);
        if(x==q3.q[4])
        {
            printf("Correct\n");
            goto l3_6;
        }
        else
        {
            printf("wrong\n");
            goto l3_5;
        }
    l3_6:  printf("\n\n6. What is the output of this C code?\n1. #include\n2. enum birds {SPARROW, PEACOCK, PARROT};\n3. enum animals {TIGER = 8, LION, RABBIT, ZEBRA};\n4. int main()\n5. {\n6. enum birds m = TIGER;\n7. int k;\n8. k = m;\n9. printf(\"%d\", k)\;\n10. return 0;\n11. }\n ");
            printf("options\n1. 0\n2. Compile time error\n3. 1 \n4. 8\n");
        printf("Enter the choice : ");
        scanf("%d",&x);
        if(x==q3.q[5])
        {
            printf("Correct\n");
            goto l3_7;
        }
        else
        {
            printf("wrong\n");
            goto l3_6;
        }
    l3_7: printf("\n\n7. enum types are processed by\n1. Compiler\n2. Preprocessor\n3. Linker\n4. Assembler\n");
        printf("Enter the choice : ");
        scanf("%d",&x);
        if(x==q3.q[6])
        {
            printf("Correct\n");
            goto l3_8;
        }
        else
        {
            printf("wrong\n");
            goto l3_7;
        }
    l3_8: printf("\n\n8. Which is false?\n");
            printf("options\n1. Constant variables need not be defined as they are declared and can be defined later\n2. Global constant variables are initialised to zero\n3. const keyword is used to define constant values\n4. You cannot reassign a value to a constant variable\n");
        printf("Enter the choice : ");
        scanf("%d",&x);
        if(x==q3.q[7])
        {
            printf("Correct\n");
            goto l3_9;
        }
        else
        {
            printf("wrong\n");
            goto l3_8;
        }
    l3_9:  printf("\n\n9. Comment on the output of this C code?\n1. #include\n2. int const print()\n3. {\n4. printf(\"Sanfoundry.com\")\;\n5. return 0;\n6. }\n7. void main()\n8. {\n9. print();\n10. }\n");
            printf("options\n1. Error because function name cannot be preceded by const \n2. Sanfoundry.com  \n3. Sanfoundry.com is printed infinite times \n4. Blank screen, no output\n");
        printf("Enter the choice : ");
        scanf("%d",&x);
        if(x==q3.q[8])
        {
            printf("Correct\n");
            goto l3_10;
        }
        else
        {
            printf("wrong\n");
            goto l3_9;
        }
    l3_10: printf("\n\n10. Comment on the output of this C code?\n1. #include\n2. void main()\n3. {\n4. int const k = 5;\n5. k++;\n6. printf(\"k is %d\", k)\;\n7. }\n");
            printf("options\n1. k is 6\n2. Error due to const succeeding int \n3. Error, because a constant variable can be changed only twice \n4. Error, because a constant variable cannot be changed\n");
        printf("Enter the choice : ");
        scanf("%d",&x);
        if(x==q3.q[9])
        {
            printf("Correct\n");
            //operators();
        }
        else
        {
            printf("wrong\n");
            goto l3_10;
        }
}

Desktop (please complete the following information):

  • OS: Linux

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.