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

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

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

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

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

भाषा
प्रश्न 1उत्तर + हल
इस C प्रोग्राम कोड का आउटपुट क्या है?

#include<stdio.h>

int main()

{

int x = -2;

x = x >> 1;

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

}
What is the output of this C program code?

#include<stdio.h>

int main()

{

int x = -2;

x = x >> 1;

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

}
  1. A1
  2. B-1
  3. C-2
  4. D-4

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

हल / Solution
ऋणात्मक संख्या भीतर दो का पूरक (two's complement) रूप में रखी जाती है, सो 32 बिट में -2 के सारे बिट एक होते हैं और आख़िरी शून्य। दायाँ खिसकाव (right shift) पर चिह्न वाला बिट बना रहता है, इसलिए सारे बिट एक हो जाते हैं और वही -1 दिखाता है। मानक संकलकों में यही अंकगणितीय खिसकाव चलता है, सो आउटपुट -1 आता है और विकल्प 2 सही है। -4 तो गुणा करने जैसा नतीजा होता।
A negative number is stored in two's complement form, so in 32 bits -2 has all bits set to one except the last. On a right shift the sign bit is preserved, so every bit becomes one, and that pattern stands for -1. Mainstream compilers all use this arithmetic shift, so the output is -1 and option 2 is correct. A value of -4 would come from multiplying instead of dividing.
प्रश्न 2उत्तर + हल
इस C प्रोग्राम कोड का आउटपुट क्या है?

#include<stdio.h>

int main()

{

int x = 2;

x = x << 1;

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

}
What is the output of this C program code?

#include<stdio.h>

int main()

{

int x = 2;

x = x << 1;

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

}
  1. A4
  2. B1
  3. C2
  4. DDepends on the compiler

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

हल / Solution
<< बायाँ खिसकाव (left shift) ऑपरेटर है, जो मान के बिट बाईं ओर सरका देता है। दो का द्विआधारी रूप 00000010 है; एक बिट बाएँ सरकाने पर वह 00000100 बनता है, यानी दशमलव में चार। आम नियम यही है कि एक बिट खिसकाना दो से गुणा करने जैसा होता है। इसलिए x में चार जाता है और विकल्प 1 सही है। यह नतीजा पक्का है, सो संकलक पर निर्भर वाला विकल्प भी नहीं चलता।
The << sign is the left shift operator, which slides the bits of a value towards the left. Two is 00000010 in binary, and shifting one bit left gives 00000100, that is four in decimal. As a rule, shifting left by one bit works like multiplying by two. So x receives four and option 1 is correct. The result is fixed here, so the compiler dependent choice does not apply.
प्रश्न 3उत्तर + हल
इस C प्रोग्राम कोड का आउटपुट क्या है?

#include<stdio.h>

void main()

{

int a = -5;

int k = (a++, ++a);

printf("%d\n", k);

}
What is the output of this C program code?

#include<stdio.h>

void main()

{

int a = -5;

int k = (a++, ++a);

printf("%d\n", k);

}
  1. A-3
  2. B-5
  3. C4
  4. DUndefined

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

हल / Solution
कोष्ठक में अल्पविराम ऑपरेटर (comma operator) लगा है। वह बाएँ से दाएँ हर भाग चलाता है पर मान सिर्फ़ आख़िरी भाग का लौटाता है, और हर अल्पविराम पर एक क्रम-बिंदु (sequence point) होता है, सो यह व्यवहार तय है। a ऋण पाँच से शुरू होकर a++ पर ऋण चार और ++a पर ऋण तीन हो जाता है। आख़िरी भाग का मान ऋण तीन है, सो k में वही जाता है और विकल्प 1 सही है।
The brackets hold the comma operator. It runs each part from left to right but returns only the value of the last part, and every comma is a sequence point, so the behaviour is well defined. Starting from minus five, a++ raises a to minus four and ++a raises it to minus three. The last part evaluates to minus three, so k gets that value and option 1 is correct.
प्रश्न 4उत्तर + हल
इस C प्रोग्राम कोड का आउटपुट क्या है?

#include<stdio.h>

void main()

            {

                    int a = 5, b = -7, c = 0, d;

                    d = ++a && ++b || ++c;

                    printf("\n%d%d%d%d", a, b, c, d);

    }
What is the output of this C program code?

#include<stdio.h>

void main()

            {

                    int a = 5, b = -7, c = 0, d;

                    d = ++a && ++b || ++c;

                    printf("\n%d%d%d%d", a, b, c, d);

    }
  1. A6  -6  0  0
  2. B6  -5  0  1
  3. C-6  -6  0  1
  4. D6  -6  0  1

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

हल / Solution
++a से a छह बनता है, जो शून्य नहीं, सो वह सच है। ++b से b ऋण छह बनता है, जो शून्य नहीं, इसलिए वह भी सच माना जाता है। सो && का नतीजा एक आता है। अब एक || ++c बचता है, और OR बायाँ भाग सच देखकर दायाँ छोड़ देता है — सो ++c नहीं चलता और c शून्य रहता है। d एक रहता है, सो 6 -6 0 1 छपता है और विकल्प 4 सही है।
The pre-increment makes a six, and six is not zero, so it counts as true. Then ++b makes b minus six, which is also not zero, so it is true as well, and && yields one. What remains is 1 || ++c, and OR skips its right side once the left is true, so ++c never runs and c stays zero. With d holding one, the output is 6 -6 0 1, so option 4 is correct.
प्रश्न 5उत्तर + हल
इस C प्रोग्राम कोड का आउटपुट क्या है?

#include<stdio.h>

void main()

{

        int x = 4, y, z;

        y = --x;

        z = x--;

        printf("%d%d%d", x, y, z);

}
What is the output of this C program code?

#include<stdio.h>

void main()

{

        int x = 4, y, z;

        y = --x;

        z = x--;

        printf("%d%d%d", x, y, z);

}
  1. A3  2  3
  2. B2  2  3
  3. C3  2  2
  4. D2  3  3

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

हल / Solution
x चार से शुरू होता है। y = --x में पूर्व-ह्रास (pre-decrement) है, सो पहले x घटकर तीन होता है और वही तीन y में जाता है। आगे z = x-- में पश्च-ह्रास (post-decrement) है, इसलिए पहले पुराना तीन z में जाता है और उसके बाद x घटकर दो रह जाता है। छपने के क्रम में x, y, z यानी 2 3 3 आता है और विकल्प 4 सही है। बाक़ी विकल्पों में दोनों ह्रास उलट गए हैं।
x starts at four. In y = --x the pre-decrement acts first, so x drops to three and that three is stored in y. In z = x-- the post-decrement hands over the old value three to z and only then lowers x to two. Printed in the order x, y, z the output is 2 3 3, which makes option 4 correct. The wrong choices swap the two decrements.
प्रश्न 6उत्तर + हल
निम्नलिखित में से कौन सा लॉजिकल ऑपरेटर नहीं है?
Which of the following is not a logical operator?
  1. A&&
  2. B&
  3. C||
  4. D!

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

हल / Solution
C में तार्किक ऑपरेटर तीन ही हैं — && यानी AND, || यानी OR और ! यानी NOT। अकेला & इनमें नहीं आता; वह बिटवार AND (bitwise AND) है, जो मानों के एक-एक बिट पर काम करता है। इसलिए विकल्प 2 सही है। फ़र्क़ याद रखिए — && शर्त जाँचकर 1 या 0 देता है और ज़रूरत न हो तो दायाँ भाग छोड़ देता है, पर & दोनों भाग हमेशा लेकर बिट जोड़ता है।
C has only three logical operators: && for AND, || for OR and ! for NOT. A single & is not one of them; it is the bitwise AND, which works on the individual bits of its operands. So option 2 is correct. Keep the difference in mind: && tests a condition, returns 1 or 0 and may skip its right side, whereas & always takes both sides and combines their bits.
प्रश्न 7उत्तर + हल
मान लीजिए b=200 और c=30, निम्न एक्सप्रेशन के अनुसार वेरिएबल num का मान क्या है:- 

num=b-=c*=5;
Suppose b=200 and c=30, what is the value of the variable num as per the following expression:- 

num=b-=c*=5;
  1. A600
  2. B50
  3. C150
  4. D-30

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

हल / Solution
नियुक्ति (assignment) वाले ऑपरेटर दाएँ से बाएँ जुड़ते हैं, इसलिए पहले c *= 5 चलता है और c का मान 30 से 150 हो जाता है। उसके बाद b -= 150 होता है, यानी b में 200 से 150 घटाकर 50 बचता है। नियुक्ति का मान वही होता है जो रखा गया, सो num में भी 50 जाता है और विकल्प 2 सही है। बाक़ी विकल्प बीच के मान या ग़लत गुणा से बनते हैं।
Assignment operators group from right to left, so c *= 5 runs first and c rises from 30 to 150. Then b -= 150 executes, leaving b with 200 minus 150, that is 50. The value of an assignment is the value just stored, so num also receives 50, which makes option 2 correct. The other choices come from the intermediate value of c or from multiplying wrongly.
प्रश्न 8उत्तर + हल
आउटपुट निर्धारित कीजिए:-

#include<stdio.h>

void main()

{

 int a, b=7;

 a = b<4 ? b<<1 : ++b>4 ? 7>>1 : a;

 printf("%d %d", a, b);

}
Determine the output:-

#include<stdio.h>

void main()

{

 int a, b=7;

 a = b<4 ? b<<1 : ++b>4 ? 7>>1 : a;

 printf("%d %d", a, b);

}
  1. A3 7
  2. B7 3
  3. C8 3
  4. D3 8

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

हल / Solution
पहली शर्त b < 4 देखिए — b सात है, सो वह झूठी है और b << 1 वाला भाग छूट जाता है। अब भीतर का दूसरा त्रिचर (ternary) चलता है: ++b पहले b को आठ करता है, और 8 > 4 सच है, इसलिए 7 >> 1 चुना जाता है। दायाँ खिसकाव एक बिट का यानी दो से भाग, सो सात का तीन बनता है। a में तीन और b में आठ — विकल्प 4 सही है।
Look at the first condition b < 4; b is seven, so it is false and the part b << 1 is skipped. The inner ternary now runs: ++b first makes b eight, and 8 > 4 is true, so 7 >> 1 is chosen. A right shift of one bit means division by two, so seven becomes three. Thus a holds three and b holds eight, which makes option 4 correct.
प्रश्न 9उत्तर + हल
आउटपुट निर्धारित कीजिए:

#include<stdio.h>

void main()

{

int i=10;

i = !i>14;

printf("i=%d", i);

}
Determine the output:

#include<stdio.h>

void main()

{

int i=10;

i = !i>14;

printf("i=%d", i);

}
  1. A10
  2. B14
  3. C0
  4. D1

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

हल / Solution
निषेध (NOT) की प्राथमिकता (precedence) तुलना से ऊँची है, इसलिए कथन (!i) > 14 की तरह पढ़ा जाता है। i में 10 है, जो शून्य नहीं, सो वह सच माना जाता है और !10 शून्य देता है। अब 0 > 14 झूठा है, और झूठ का मान शून्य होता है। वही i में जाता है, इसलिए आउटपुट i=0 आता है और विकल्प 3 सही है। 1 तब मिलता जब तुलना सच होती।
The NOT operator binds tighter than a comparison, so the line reads as (!i) > 14. Since i is 10 and that is not zero, it counts as true, so !10 gives zero. Now 0 > 14 is false, and a false test has the value zero, which is stored back in i. The program prints i=0, so option 3 is correct. A result of 1 would need the comparison to hold.
प्रश्न 10उत्तर + हल
आउटपुट निर्धारित कीजिए:

#include<stdio.h>

void main()

{

int i=0, j=1, k=2, m;

m = i++ || j++ || k++;

printf("%d %d %d %d", m, i, j, k);

}
Determine the output:

#include<stdio.h>

void main()

{

int i=0, j=1, k=2, m;

m = i++ || j++ || k++;

printf("%d %d %d %d", m, i, j, k);

}
  1. A1 1 2 3
  2. B1 1 2 2
  3. C0 1 2 2
  4. D0 1 2 3

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

हल / Solution
i में शून्य है और i++ पहले वही पुराना मान देता है, इसलिए पहला भाग झूठा निकलता है पर i एक बन जाता है। अब j++ जाँचा जाता है; वह 1 देता है, सो कथन सच हो गया और j दो बन गया। || यहीं लघु-पथ (short-circuit) कर देता है, इसलिए k++ कभी नहीं चलता और k दो ही रहता है। m में एक जाता है, सो आउटपुट 1 1 2 2 आता है और विकल्प 2 सही है।
Since i is zero, i++ first hands over that old value, so the first part is false, but i becomes one. Next j++ is examined; it gives 1, so the expression turns true and j becomes two. The || operator short-circuits right there, so k++ never runs and k stays two. The variable m receives one, so the output is 1 1 2 2 and option 2 is correct.
आगे के 20 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
App खोलिए
प्रश्न 12उत्तर app में
निम्नलिखित C भाषा कोड का आउटपुट क्या होगा?

#include <stdio.h>

int main()

{

        int a = 10, b = 5, c = 3;

        b != !a;

        c = !!a;

        printf("%d\t%d", b, c);

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

#include <stdio.h>

int main()

{

        int a = 10, b = 5, c = 3;

        b != !a;

        c = !!a;

        printf("%d\t%d", b, c);

}
  1. A5 1
  2. B0 3
  3. C5 3
  4. D1 1
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 19उत्तर app में
दिए गए C भाषा प्रोग्राम का आउटपुट ज्ञात कीजिए।

#include<stdio.h>

int main()

{

  int x=55, y=20, a;

  a = (x == 55 || y>20);

  printf("%d ", a);

  return 0;

}
Find the output of the given C language program.

#include<stdio.h>

int main()

{

  int x=55, y=20, a;

  a = (x == 55 || y>20);

  printf("%d ", a);

  return 0;

}
  1. A1
  2. B20
  3. C0
  4. D55
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 20उत्तर app में
दिए गए C भाषा प्रोग्राम का आउटपुट ज्ञात कीजिए।

#include<stdio.h>

int main()

{

  int a,b;

  a = 9;

  b = 5;

  printf("%d ", a == b);

  printf("%d", a = b);

  return 0;

}
Find the output of the given C language program.

#include<stdio.h>

int main()

{

  int a,b;

  a = 9;

  b = 5;

  printf("%d ", a == b);

  printf("%d", a = b);

  return 0;

}
  1. A1 0
  2. B0 5
  3. C1 5
  4. D0 0
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 21उत्तर app में
दिए गए C भाषा प्रोग्राम का आउटपुट ज्ञात कीजिए।

#include<stdio.h>

int main()

{

  int a,b,c;

  a = b = 10;

  c = a == b;

  printf("%d %d %d",a,b,c);

  return 0;

}
Find the output of the given C language program.

#include<stdio.h>

int main()

{

  int a,b,c;

  a = b = 10;

  c = a == b;

  printf("%d %d %d",a,b,c);

  return 0;

}
  1. A10 10 10
  2. B10 10 1
  3. C1 1 1
  4. D10 10 0
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 23उत्तर app में
दिए गए C भाषा प्रोग्राम का आउटपुट ज्ञात कीजिए।

#include<stdio.h>

int main()

{

  int i=10;

  i= !i < 5;

  printf("%d",i);

  return 0;

}
Find the output of the given C language program.

#include<stdio.h>

int main()

{

  int i=10;

  i= !i < 5;

  printf("%d",i);

  return 0;

}
  1. A0
  2. B1
  3. CGarbage Value
  4. D10
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 24उत्तर app में
दिए गए C भाषा प्रोग्राम का आउटपुट ज्ञात कीजिए।

#include<stdio.h>

int main()

{

  int a=5;

  int b= !9 && a;

  printf("%d",b);

  return 0;

}
Find the output of the given C language program.

#include<stdio.h>

int main()

{

  int a=5;

  int b= !9 && a;

  printf("%d",b);

  return 0;

}
  1. A1
  2. B9
  3. C0
  4. D5
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 25उत्तर app में
दिए गए C भाषा प्रोग्राम का आउटपुट ज्ञात कीजिए।

#include< stdio.h>

int main()

{

  int x, y, z;

  x = 9;

  y = 10;

  z = x == y;

  printf("%d", z);

  return 0;

}
Find the output of the given C language program.

#include< stdio.h>

int main()

{

  int x, y, z;

  x = 9;

  y = 10;

  z = x == y;

  printf("%d", z);

  return 0;

}
  1. ANone of these
  2. BGarbage Value
  3. C0
  4. D1
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 26उत्तर app में
दिए गए C भाषा प्रोग्राम का आउटपुट ज्ञात कीजिए।

#include<stdio.h>

int main()

{

  printf("%d ", -9 && 9);

  printf("%d", -9 || 9);

  return 0;

}
Find the output of the given C language program.

#include<stdio.h>

int main()

{

  printf("%d ", -9 && 9);

  printf("%d", -9 || 9);

  return 0;

}
  1. A0 0
  2. B0 1
  3. C1 1
  4. D1 0
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 27उत्तर app में
दिए गए C भाषा प्रोग्राम का आउटपुट ज्ञात कीजिए।

#include<stdio.h>

int main()

{

  int x=0, y=0;

  printf("%d ", x++ && ++y);

  printf("%d %d\t",x,y);

  x = 0, y=1;

  printf("%d ", ++x || ++y);

  printf("%d %d",x,y);

  return 0;

}
Find the output of the given C language program.

#include<stdio.h>

int main()

{

  int x=0, y=0;

  printf("%d ", x++ && ++y);

  printf("%d %d\t",x,y);

  x = 0, y=1;

  printf("%d ", ++x || ++y);

  printf("%d %d",x,y);

  return 0;

}
  1. A0 1 0 1 1 2
  2. B0 1 1 1 1 1
  3. C0 1 0 1 1 1
  4. D0 1 1 1 1 2
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 28उत्तर app में
दिए गए C भाषा प्रोग्राम का आउटपुट ज्ञात कीजिए।

#include<stdio.h>

int main()

{

  int a;

  a = 'a' > 'A';

  printf("%d",a);

  return 0;

}
Find the output of the given C language program.

#include<stdio.h>

int main()

{

  int a;

  a = 'a' > 'A';

  printf("%d",a);

  return 0;

}
  1. A65
  2. B0
  3. C1
  4. D97
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 29उत्तर app में
दिए गए C भाषा प्रोग्राम का आउटपुट ज्ञात कीजिए।

#include<stdio.h>

int main()

{

  printf("%d ",5>2 && 1<2);

  printf("%d ", 4>5 || 2<1);

  printf("%d ",!(2>3));

  return 0;

}
Find the output of the given C language program.

#include<stdio.h>

int main()

{

  printf("%d ",5>2 && 1<2);

  printf("%d ", 4>5 || 2<1);

  printf("%d ",!(2>3));

  return 0;

}
  1. A0 1 0
  2. B0 1 1
  3. C1 0 0
  4. D1 0 1
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 30उत्तर app में
दिए गए C भाषा प्रोग्राम का आउटपुट ज्ञात कीजिए।

#include<stdio.h>

int main()

{

  int a=-1, b=1, c, d;

  c = !a && b;

  d = !a || b;

  printf("%d %d %d %d",a,b,c,d);

  return 0;

}
Find the output of the given C language program.

#include<stdio.h>

int main()

{

  int a=-1, b=1, c, d;

  c = !a && b;

  d = !a || b;

  printf("%d %d %d %d",a,b,c,d);

  return 0;

}
  1. A-1 1 1 0
  2. B-1 1 0 0
  3. C-1 1 1 1
  4. D-1 1 0 1
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
Operator in C Language के सभी 209 प्रश्न — उत्तर, हल और अभ्यास

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

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

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

C Language के दूसरे topics

सभी topics