FliQi Education App Download
प्रश्न-बैंक · C Language

Structure in C Language — प्रश्न और उत्तर

C Language · 103 जाँचे हुए (verified) प्रश्न

  • 103 जाँचे हुए प्रश्न
  • हिंदी + English

पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 20 के उत्तर और हल FliQi Question Bank app में।

भाषा
प्रश्न 1उत्तर + हल
typedef डिक्लेरेशन क्या है?
What is typedef declaration?
  1. Aकोई नया प्रकार नहीं बनाता हैDoes not create a new type
  2. Bयह केवल कुछ मौजूदा प्रकार के लिए एक नया नाम जोड़ता हैIt merely adds a new name for some existing type
  3. Cकोई नया प्रकार नहीं बनाता है, यह केवल कुछ मौजूदा प्रकार के लिए एक नया नाम जोड़ता हैDoes not create a new type, It merely adds a new name for some existing type
  4. Dउल्लिखित में से कोई नहींNone of the mentioned

सही उत्तर / Answer: (C)

हल / Solution
typedef कोई नया डाटा टाइप (data type) नहीं बनाता; वह किसी पहले से मौजूद टाइप को दूसरा नाम, यानी उपनाम (alias), दे देता है। typedef int integer; लिखने पर integer और int एक ही टाइप रहते हैं, कोई तीसरा टाइप नहीं बनता। विकल्प 1 और 2 इसी एक बात के आधे-आधे हिस्से हैं, इसलिए अकेले अधूरे हैं। विकल्प 3 दोनों हिस्से साथ कहता है, सो पूरी परिभाषा वही है, और विकल्प 4 ग़लत है क्योंकि सही कथन मौजूद है।
A typedef does not create a new data type. It only gives an existing type a second name, that is an alias. After typedef int integer; the names integer and int mean exactly the same type, so nothing new comes into being. Options 1 and 2 are the two halves of this single idea, so each alone is incomplete. Option 3 states both halves, which is the full definition.
प्रश्न 2उत्तर + हल
typedef के बारे में निम्नलिखित में से कौन-सा कथन असत्य है?
Which of the following is false about typedef?
  1. Atypedef स्कोप नियमों का पालन करता हैtypedef follow scope rules
  2. Btypedef से परिभाषित विकल्पों को दोबारा परिभाषित किया जा सकता है। (उदाहरण: typedef char a; typedef int a;)typedef defined substitutes can be redefined again. (Eg: typedef char a; typedef int a;)
  3. Cआप किसी typedef को दूसरे टर्म के साथ typedef कर सकते हैंYou can typedef a typedef with other term
  4. Dउल्लिखित सभीAll of the mentioned

सही उत्तर / Answer: (B)

हल / Solution
दूसरा कथन असत्य है। एक ही क्षेत्र (scope) में किसी typedef नाम को दोबारा दूसरे प्रकार से नहीं बाँधा जा सकता, सो उदाहरण में दिए दोनों typedef एक साथ लिखने पर टकराव की त्रुटि आती है। पहला कथन सही है, क्योंकि typedef नाम चरों की तरह क्षेत्र के नियम मानते हैं। तीसरा भी सही है, क्योंकि एक typedef के ऊपर दूसरा typedef बनाया जा सकता है। दो कथन सही होने से चौथा विकल्प अपने-आप ग़लत हो जाता है।
The second statement is the false one. Within the same scope a typedef name cannot be bound again to a different type, so writing both typedef lines of the example together gives a conflicting types error. The first statement is true, because typedef names obey scope rules just as variables do. The third is true as well, since one typedef can be built on top of another. As two statements are true, the fourth choice fails.
प्रश्न 3उत्तर + हल
दिए गए विकल्पों में से आरंभीकरण (initialization) का सही तरीक़ा कौन-सा है?

typedef char *string;
Which of the given options is the correct method for initialization?

typedef char *string;
  1. A*string *p = "Hello";
  2. Bstring p = "Hello";
  3. C*string p = 'A';
  4. Dtypedef का उपयोग करते समय एक से अधिक स्थान नहीं दिया जाना चाहिएNot more than one space should be given when using typedef

सही उत्तर / Answer: (B)

हल / Solution
typedef वाली पंक्ति से string नाम उस प्रकार का पर्याय बन जाता है जो char का सूचक है। इसलिए दूसरा रूप भीतर से char का सूचक बनाकर उसमें डोरी का पता रख देता है, और यही सही आरंभीकरण है। पहले विकल्प में एक अतिरिक्त तारा लग गया है, जिससे सूचक का सूचक बन जाता है। तीसरे में अक्षर स्थिरांक दिया है, डोरी नहीं। चौथे का typedef से कोई लेना-देना नहीं, जगह गिनने का कोई नियम होता ही नहीं।
The typedef line makes the name string stand for the type pointer to char. So the second form really declares a pointer to char and stores the address of the string in it, and that is the correct initialization. The first choice adds one more star, which turns it into a pointer to a pointer. The third assigns a character constant instead of a string. The fourth has nothing to do with typedef, since spacing makes no difference.
प्रश्न 4उत्तर + हल
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    typedef struct p

    {

        int x, y;

    }k;

    int main()

    {

        struct p p = {1, 2};

        k k1 = p;

        printf("%d\n", k1.x);

    }
What will be the output of the following C code?

#include <stdio.h>

    typedef struct p

    {

        int x, y;

    }k;

    int main()

    {

        struct p p = {1, 2};

        k k1 = p;

        printf("%d\n", k1.x);

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. B1
  3. C0
  4. D2

सही उत्तर / Answer: (B)

हल / Solution
इस typedef से दो नाम बनते हैं — struct p और उसका छोटा नाम k, और दोनों एक ही प्रकार हैं। इसलिए संरचना भरते समय x में एक और y में दो बैठता है, और अगली पंक्ति पूरी संरचना की नक़ल k1 में कर देती है। C में एक ही प्रकार की संरचना दूसरी में सीधे रखी जा सकती है, सो कोई त्रुटि नहीं आती। k1.x वही एक है, इसलिए एक छपता है; दो तो y का मान है।
This typedef creates two names, struct p and the shorter name k, and both stand for the same type. So while filling the structure, one goes into x and two into y, and the next line copies the whole structure into k1. Assigning one structure to another of the same type is allowed in C, so no error occurs. Then k1.x is still one, which is what gets printed, while two is the value of y.
प्रश्न 5उत्तर + हल
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    typedef struct p

    {

        int x, y;

    }k = {1, 2};

    int main()

    {

        p k1 = k;

        printf("%d\n", k1.x);

    }
What will be the output of the following C code?

#include <stdio.h>

    typedef struct p

    {

        int x, y;

    }k = {1, 2};

    int main()

    {

        p k1 = k;

        printf("%d\n", k1.x);

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. B1
  3. C0
  4. Dमानक पर निर्भर करता हैDepends on the standard

सही उत्तर / Answer: (A)

हल / Solution
typedef वाली घोषणा में आरंभिक मान (initializer) नहीं दिया जा सकता, पर यहाँ k को उपनाम (alias) बनाकर उसी में {1, 2} भी भर दिया गया है; संकलक (compiler) इसे अस्वीकार कर देता है। दूसरी चूक आगे है — p केवल टैग (tag) है, टाइप नहीं, इसलिए p k1 भी ग़लत है और वहाँ struct p k1; चाहिए था। दो-दो कारणों से संकलन रुक जाता है, सो उत्तर कम्पाइल टाइम एरर है और 1 छपने का सवाल नहीं।
A typedef declaration cannot carry an initializer, yet here k is made an alias and is also filled with {1, 2} in the same line, which the compiler rejects. There is a second fault too: p is only the structure tag and not a type name, so p k1 is wrong and struct p k1; would be needed. Two faults stop compilation, so the answer is a compile time error.
प्रश्न 6उत्तर + हल
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    typedef struct p

    {

        int x, y;

    };

    int main()

    {

        p k1 = {1, 2};

        printf("%d\n", k1.x);

    }
What will be the output of the following C code?

#include <stdio.h>

    typedef struct p

    {

        int x, y;

    };

    int main()

    {

        p k1 = {1, 2};

        printf("%d\n", k1.x);

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. B1
  3. C0
  4. Dमानक पर निर्भर करता हैDepends on the standard

सही उत्तर / Answer: (A)

हल / Solution
typedef लिखने पर आगे उपनाम (alias) देना ज़रूरी है, जैसे typedef struct p { int x, y; } k;। यहाँ घोषणा में कोई उपनाम ही नहीं दिया गया, इसलिए p नाम का कोई टाइप बनता ही नहीं — p केवल structure का टैग (tag) है और struct p लिखकर ही चलता है। आगे p k1 लिखा है, सो संकलक (compiler) वहीं रुक जाता है और कम्पाइल टाइम एरर मिलता है।
A typedef must be followed by an alias name, as in typedef struct p { int x, y; } k;. Here the declaration gives no alias, so no type named p comes into being; p is only the structure tag and works only as struct p. The next line writes p k1, so the compiler refuses to treat p as a type name and stops with a compile time error.
प्रश्न 7उत्तर + हल
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    typedef int integer;

    int main()

    {

        int i = 10, *ptr;

        float f = 20;

        integer j = i;

        ptr = &j;

        printf("%d\n", *ptr);

        return 0;

    }
What will be the output of the following C code?

#include <stdio.h>

    typedef int integer;

    int main()

    {

        int i = 10, *ptr;

        float f = 20;

        integer j = i;

        ptr = &j;

        printf("%d\n", *ptr);

        return 0;

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. B20
  3. Cएड्रेसAddress
  4. D10

सही उत्तर / Answer: (D)

हल / Solution
typedef int integer; के बाद integer और int एक ही टाइप हैं, इसलिए integer j = i; से j में 10 चला जाता है। फिर ptr = &j; से पॉइंटर (pointer) j के पते पर पहुँचता है और *ptr उसी खाने का मान, यानी 10, लौटाता है। float चर f घोषित तो है पर इस्तेमाल नहीं हुआ, सो 20 छप नहीं सकता। %d के साथ *ptr मान छापता है, पता नहीं।
After typedef int integer; the names integer and int mean the same type, so integer j = i; puts 10 into j. Then ptr = &j; makes the pointer hold the address of j, and *ptr reads the value stored there, which is 10. The float variable f is declared but never used, so 20 cannot be printed. With %d the expression *ptr prints a value, not an address.
प्रश्न 8उत्तर + हल
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    typedef struct student

    {

        char *a;

    }stu;

    void main()

    {

        stu s;

        s.a = "hi";

        printf("%s", s.a);

    }
What will be the output of the following C code?

#include <stdio.h>

    typedef struct student

    {

        char *a;

    }stu;

    void main()

    {

        stu s;

        s.a = "hi";

        printf("%s", s.a);

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. Bबदलता रहता हैVaries
  3. Chi
  4. Dh

सही उत्तर / Answer: (C)

हल / Solution
यहाँ stu उपनाम (typedef alias) है, इसलिए stu s; पूरी तरह वैध घोषणा है। structure के भीतर char *a; एक कैरेक्टर पॉइंटर (character pointer) है, और s.a = "hi"; उसमें स्ट्रिंग लिटरल (string literal) का पता भर देता है। printf में %s उस पते से शुरू होकर पूरी स्ट्रिंग छापता है, इसलिए आउटपुट hi है। केवल पहला अक्षर h तब आता जब %c लगाया गया होता। कोड वैध है, सो न एरर मिलता है और न आउटपुट बदलता है।
Here stu is a typedef alias, so stu s; is a perfectly valid declaration. Inside the structure char *a; is a character pointer, and s.a = "hi"; stores the address of the string literal in it. In printf the %s specifier starts at that address and prints the whole string, so the output is hi. Only the first letter h would appear if %c had been used instead.
प्रश्न 9उत्तर + हल
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    typedef struct student

    {

        char *a;

    }stu;

    void main()

    {

        struct stu s;

        s.a = "hi";

        printf("%s", s.a);

    }
What will be the output of the following C code?

#include <stdio.h>

    typedef struct student

    {

        char *a;

    }stu;

    void main()

    {

        struct stu s;

        s.a = "hi";

        printf("%s", s.a);

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. Bबदलता रहता हैVaries
  3. Chi
  4. Dh

सही उत्तर / Answer: (A)

हल / Solution
typedef struct student { ... } stu; में stu एक उपनाम (typedef alias) है, structure का टैग (tag) नहीं; टैग तो student है। इसलिए चर बनाने के दो ही सही रूप हैं — stu s; या struct student s;। प्रोग्राम में struct stu s; लिखा है, और संकलक (compiler) struct stu नाम का कोई structure नहीं ढूँढ़ पाता, इसलिए कम्पाइल टाइम एरर आता है। संकलन ही नहीं होता, सो hi या h छपने की नौबत नहीं आती।
In typedef struct student { ... } stu; the name stu is a typedef alias and not the structure tag; the tag here is student. So a variable may be made in only two correct ways: stu s; or struct student s;. The program writes struct stu s;, and the compiler finds no structure tagged stu, so it reports a compile time error. Compilation fails, which is why neither hi nor h can be printed.
प्रश्न 10उत्तर + हल
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    int main()

    {

        struct p

        {

            char *name;

            struct p *next;

        };

        struct p p, q;

        p.name = "xyz";

        p.next = NULL;

        ptrary[0] = &p;

        strcpy(q.name, p.name);

        ptrary[1] = &q;

        printf("%s\n", ptrary[1]->name);

        return 0;

    }
What will be the output of the following C code?

#include <stdio.h>

    int main()

    {

        struct p

        {

            char *name;

            struct p *next;

        };

        struct p p, q;

        p.name = "xyz";

        p.next = NULL;

        ptrary[0] = &p;

        strcpy(q.name, p.name);

        ptrary[1] = &q;

        printf("%s\n", ptrary[1]->name);

        return 0;

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. Bकंपाइलर पर निर्भर करता हैDepends on the compiler
  3. Cअपरिभाषित व्यवहारUndefined behaviour
  4. Dxyz

सही उत्तर / Answer: (A)

हल / Solution
इस कोड में ptrary नाम का कोई चर (variable) कहीं घोषित ही नहीं हुआ है, फिर भी उसे सरणी (array) की तरह इस्तेमाल किया गया है। बिना घोषणा वाला नाम देखकर संकलक (compiler) वहीं रुक जाता है, इसलिए कम्पाइल टाइम एरर मिलता है। प्रोग्राम चलता ही नहीं, सो xyz छपने का सवाल नहीं। चूक निश्चित है — न कंपाइलर पर निर्भर, न अपरिभाषित व्यवहार (undefined behaviour), क्योंकि वे संकलित प्रोग्राम में ही दिखते हैं।
The variable ptrary is never declared anywhere in this program, yet it is used as an array. An undeclared identifier stops the compiler immediately, so the program gives a compile time error. Since compilation never finishes, nothing runs and printing xyz is impossible. The fault is a fixed one, not compiler dependent, and it is not undefined behaviour either, because both of those need a program that compiles first.
आगे के 20 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
App खोलिए
प्रश्न 11उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct p

    {

        char *name;

        struct p *next;

    };

    struct p *ptrary[10];

    int main()

    {

        struct p p, q;

        p.name = "xyz";

        p.next = NULL;

        ptrary[0] = &p;

        strcpy(q.name, p.name);

        printf("%s\n", ptrary[1]->name);

        return 0;

    }
What will be the output of the following C code?

#include <stdio.h>

    struct p

    {

        char *name;

        struct p *next;

    };

    struct p *ptrary[10];

    int main()

    {

        struct p p, q;

        p.name = "xyz";

        p.next = NULL;

        ptrary[0] = &p;

        strcpy(q.name, p.name);

        printf("%s\n", ptrary[1]->name);

        return 0;

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. Bसेगमेंटेशन फ़ॉल्ट / कोड क्रैशSegmentation fault/code crash
  3. Cकंपाइलर पर निर्भर करता हैDepends on the compiler
  4. Dxyz
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 12उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct p

    {

        char *name;

        struct p *next;

    };

    struct p *ptrary[10];

    int main()

    {

        struct p p;

        p.name = "xyz";

        p.next = NULL;

        ptrary[0] = &p;

        printf("%s\n", ptrary[0]->name);

        return 0;

    }
What will be the output of the following C code?

#include <stdio.h>

    struct p

    {

        char *name;

        struct p *next;

    };

    struct p *ptrary[10];

    int main()

    {

        struct p p;

        p.name = "xyz";

        p.next = NULL;

        ptrary[0] = &p;

        printf("%s\n", ptrary[0]->name);

        return 0;

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. Bसेगमेंटेशन फ़ॉल्टSegmentation fault
  3. Cअपरिभाषित व्यवहारUndefined behaviour
  4. Dxyz
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 13उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct p

    {

        char *name;

        struct p *next;

    };

    struct p *ptrary[10];

    int main()

    {

        struct p p;

        p->name = "xyz";

        p->next = NULL;

        ptrary[0] = &p;

        printf("%s\n", p->name);

        return 0;

    }
What will be the output of the following C code?

#include <stdio.h>

    struct p

    {

        char *name;

        struct p *next;

    };

    struct p *ptrary[10];

    int main()

    {

        struct p p;

        p->name = "xyz";

        p->next = NULL;

        ptrary[0] = &p;

        printf("%s\n", p->name);

        return 0;

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. Bसेगमेंटेशन फ़ॉल्ट / कोड क्रैशSegmentation fault/code crash
  3. Cxyz
  4. Dअपरिभाषित व्यवहारUndefined behaviour
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 14उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct student

    {

        char a[5];

    };

    void main()

    {

        struct student s[] = {"hi", "hey"};

        printf("%c", s[0].a[1]);

    }
What will be the output of the following C code?

#include <stdio.h>

    struct student

    {

        char a[5];

    };

    void main()

    {

        struct student s[] = {"hi", "hey"};

        printf("%c", s[0].a[1]);

    }
  1. Ah
  2. Bi
  3. Ce
  4. Dy
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 15उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    int main()

    {

        typedef struct p *q;

        struct p

        {

            int x;

            char y;

            q ptr;

        };

        struct p p = {1, 2, &p};

        printf("%d\n", p.ptr->x);

        return 0;

    }
What will be the output of the following C code?

#include <stdio.h>

    int main()

    {

        typedef struct p *q;

        struct p

        {

            int x;

            char y;

            q ptr;

        };

        struct p p = {1, 2, &p};

        printf("%d\n", p.ptr->x);

        return 0;

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. B1
  3. Cकंपाइलर पर निर्भर करता हैDepends on the compiler
  4. Dमानक पर निर्भर करता हैDepends on the standard
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 16उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    typedef struct p *q;

    int main()

    {

        struct p

        {

            int x;

            char y;

            q ptr;

        };

        struct p p = {1, 2, &p};

        printf("%d\n", p.ptr->x);

        return 0;

    }
What will be the output of the following C code?

#include <stdio.h>

    typedef struct p *q;

    int main()

    {

        struct p

        {

            int x;

            char y;

            q ptr;

        };

        struct p p = {1, 2, &p};

        printf("%d\n", p.ptr->x);

        return 0;

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. B1
  3. Cकंपाइलर पर निर्भर करता हैDepends on the compiler
  4. Dउल्लिखित में से कोई नहींNone of the mentioned
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 17उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    typedef struct p *q;

    struct p

    {

        int x;

        char y;

        q ptr;

    };

    int main()

    {

        struct p p = {1, 2, &p};

        printf("%d\n", p.ptr->ptr->x);

        return 0;

    }
What will be the output of the following C code?

#include <stdio.h>

    typedef struct p *q;

    struct p

    {

        int x;

        char y;

        q ptr;

    };

    int main()

    {

        struct p p = {1, 2, &p};

        printf("%d\n", p.ptr->ptr->x);

        return 0;

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. Bसेगमेंटेशन गलतीSegmenation fault
  3. Cअपरिभाषित व्यवहारUndefined behaviour
  4. D1
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 18उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct p

    {

        int x;

        char y;

        struct p *ptr;

    };

    int main()

    {

        struct p p = {1, 2, &p};

        printf("%d\n", p.ptr->x);

        return 0;

    }
What will be the output of the following C code?

#include <stdio.h>

    struct p

    {

        int x;

        char y;

        struct p *ptr;

    };

    int main()

    {

        struct p p = {1, 2, &p};

        printf("%d\n", p.ptr->x);

        return 0;

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. Bअपरिभाषित व्यवहारUndefined behaviour
  3. C1
  4. D2
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 19उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct student

    {

        char *c;

        struct student *point;

    };

    void main()

    {

        struct student s;

        struct student *m = &s;

        printf("%d", sizeof(student));

    }
What will be the output of the following C code?

#include <stdio.h>

    struct student

    {

        char *c;

        struct student *point;

    };

    void main()

    {

        struct student s;

        struct student *m = &s;

        printf("%d", sizeof(student));

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. B8
  3. C5
  4. D4
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 20उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct student

    {

        char *c;

        struct student point;

    };

    void main()

    {

        struct student s;

        s.c = "hello";

        printf("%s", s.c);

    }
What will be the output of the following C code?

#include <stdio.h>

    struct student

    {

        char *c;

        struct student point;

    };

    void main()

    {

        struct student s;

        s.c = "hello";

        printf("%s", s.c);

    }
  1. Ahello
  2. Bकुछ भी नहींNothing
  3. Cबदलता रहता हैVaries
  4. Dकम्पाइल टाइम एररCompile time error
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 21उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct student

    {

        char *c;

        struct student *point;

    };

    void main()

    {

        struct student s;

        struct student m;

        m.point = s;

        (m.point)->c = "hey";

        printf("%s", s.c);

    }
What will be the output of the following C code?

#include <stdio.h>

    struct student

    {

        char *c;

        struct student *point;

    };

    void main()

    {

        struct student s;

        struct student m;

        m.point = s;

        (m.point)->c = "hey";

        printf("%s", s.c);

    }
  1. Aकुछ भी नहींNothing
  2. Bकम्पाइल टाइम एररCompile time error
  3. Chey
  4. Dबदलता रहता हैVaries
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 22उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct student

    {

        char *c;

    };

    void main()

    {

        struct student n;

        struct student *s = &n;

        (*s).c = "hello";

        printf("%p\n%p\n", s, &n);

    }
What will be the output of the following C code?

#include <stdio.h>

    struct student

    {

        char *c;

    };

    void main()

    {

        struct student n;

        struct student *s = &n;

        (*s).c = "hello";

        printf("%p\n%p\n", s, &n);

    }
  1. Aभिन्न पताDifferent address
  2. Bरन टाइम एररRun time error
  3. Cकुछ भी नहींNothing
  4. Dएक ही पताSame address
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 23उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct student

    {

        char *c;

    };

    void main()

    {

        struct student m;

        struct student *s = &m;

        s->c = "hello";

        printf("%s", m.c);

    }
What will be the output of the following C code?

#include <stdio.h>

    struct student

    {

        char *c;

    };

    void main()

    {

        struct student m;

        struct student *s = &m;

        s->c = "hello";

        printf("%s", m.c);

    }
  1. Aरन टाइम एररRun time error
  2. Bकुछ भी नहींNothing
  3. Chello
  4. Dबदलता रहता हैVaries
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 24उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct student

    {

        char *c;

    };

    void main()

    {

        struct student m;

        struct student *s = &m;

        s->c = "hello";

        printf("%s", s->c);

    }
What will be the output of the following C code?

#include <stdio.h>

    struct student

    {

        char *c;

    };

    void main()

    {

        struct student m;

        struct student *s = &m;

        s->c = "hello";

        printf("%s", s->c);

    }
  1. Ahello
  2. Bरन टाइम एररRun time error
  3. Cकुछ भी नहींNothing
  4. Dकंपाइलर पर निर्भर करता हैDepends on compiler
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 25उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct p

    {

        int x;

        char y;

    };

    int main()

    {

        struct p p1[] = {1, 92, 3, 94, 5, 96};

        struct p *ptr1 = p1;

        int x = (sizeof(p1) / sizeof(ptr1));

        if (x == 1)

            printf("%d\n", ptr1->x);

        else

            printf("false\n");

    }
What will be the output of the following C code?

#include <stdio.h>

    struct p

    {

        int x;

        char y;

    };

    int main()

    {

        struct p p1[] = {1, 92, 3, 94, 5, 96};

        struct p *ptr1 = p1;

        int x = (sizeof(p1) / sizeof(ptr1));

        if (x == 1)

            printf("%d\n", ptr1->x);

        else

            printf("false\n");

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. B1
  3. Cfalse
  4. Dअपरिभाषित व्यवहारUndefined behaviour
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 26उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct point

    {

        int x;

        int y;

    };

    void foo(struct point*);

    int main()

    {

        struct point p1[] = {1, 2, 3, 4, 5};

        foo(p1);

    }

    void foo(struct point p[])

    {

        printf("%d %d\n", p->x, p[3].y);

    }
What will be the output of the following C code?

#include <stdio.h>

    struct point

    {

        int x;

        int y;

    };

    void foo(struct point*);

    int main()

    {

        struct point p1[] = {1, 2, 3, 4, 5};

        foo(p1);

    }

    void foo(struct point p[])

    {

        printf("%d %d\n", p->x, p[3].y);

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. B1 0
  3. C1 somegarbagevalue
  4. Dउल्लिखित में से कोई नहींNone of the mentioned
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 27उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct point

    {

        int x;

        int y;

    }p[] = {1, 2, 3, 4, 5};

    void foo(struct point*);

    int main()

    {

        foo(p);

    }

    void foo(struct point p[])

    {

        printf("%d %d\n", p->x, p[2].y);

    }
What will be the output of the following C code?

#include <stdio.h>

    struct point

    {

        int x;

        int y;

    }p[] = {1, 2, 3, 4, 5};

    void foo(struct point*);

    int main()

    {

        foo(p);

    }

    void foo(struct point p[])

    {

        printf("%d %d\n", p->x, p[2].y);

    }
  1. A1 0
  2. Bकम्पाइल टाइम एररCompile time error
  3. C1 somegarbagevalue
  4. Dअपरिभाषित व्यवहारUndefined behaviour
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 28उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include <stdio.h>

    struct point

    {

        int x;

        int y;

    };

    void foo(struct point*);

    int main()

    {

        struct point p1[]  =  {1, 2, 3, 4};

        foo(p1);

    }

    void foo(struct point p[])

    {

        printf("%d\n", p[1].x);

    }
What will be the output of the following C code?

#include <stdio.h>

    struct point

    {

        int x;

        int y;

    };

    void foo(struct point*);

    int main()

    {

        struct point p1[]  =  {1, 2, 3, 4};

        foo(p1);

    }

    void foo(struct point p[])

    {

        printf("%d\n", p[1].x);

    }
  1. Aकम्पाइल टाइम एररCompile time error
  2. B3
  3. C2
  4. D1
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 29उत्तर app में
निम्न C कोड का आउटपुट क्या होगा?

#include<stdio.h>

    struct student

    {

        char *name;

    };

    struct student s[2], r[2];

    void main()

    {

        s[0].name = "alan";

        s[1] = s[0];

        r = s;

        printf("%s%s", r[0].name, r[1].name);

    }
What will be the output of the following C code?

#include<stdio.h>

    struct student

    {

        char *name;

    };

    struct student s[2], r[2];

    void main()

    {

        s[0].name = "alan";

        s[1] = s[0];

        r = s;

        printf("%s%s", r[0].name, r[1].name);

    }
  1. Aalan alan
  2. Bकम्पाइल टाइम एररCompile time error
  3. CVaries
  4. DNothing
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 30उत्तर app में
स्ट्रक्चर के ऐरे में i-वें स्ट्रक्चर के सदस्य तक पहुँचने का सही सिंटैक्स क्या है?

struct temp{

   int b;

}s[50];
The correct syntax to access the member of the ith structure in the array of structures is?

struct temp{

   int b;

}s[50];
  1. As.b.[i];
  2. Bs.[i].b;
  3. Cs.b[i];
  4. Ds[i].b;
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
Structure in C Language के सभी 103 प्रश्न — उत्तर, हल और अभ्यास

FliQi Question Bank app में topic-वार अभ्यास, कठिनाई-स्तर और आपकी प्रगति।

  • पहला test मुफ़्त
  • हिंदी + English
  • जाँचे हुए उत्तर और हल

यह topic किन परीक्षाओं में आता है

C Language के दूसरे topics

सभी topics