• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

C Operators

Question 11

C
#include<stdio.h> 
int main(void) 
{ 
  int a = 1; 
  int b = 0; 
  b = a++ + a++; 
  printf(\"%d %d\",a,b); 
  return 0; 
}
  • 3 6

  • Compiler Dependent

  • 3 4

  • 3 3

Question 12

Predict the output of following program. Assume that the characters are represented using ASCII Values. C
#include <stdio.h>
#define VAL 32
 
int main()
{
    char arr[] = \"geeksquiz\";
    *(arr + 0) &= ~VAL;
    *(arr + 5) &= ~VAL;
    printf(\"%s\", arr);
    
    return 0;
}
  • GeeksQuiz
  • geeksQuiz
  • Geeksquiz
  • geeksquiz
  • Garbage eeks Garbage uiz

Question 13

Predict the output of the below program: C
#include <stdio.h>
int main()
{
    printf(\"%d\", 1 << 2 + 3 << 4);
    return 0;
}
  • 112
  • 52
  • 512
  • 0

Question 14

Which of the following can have different meaning in different contexts?
  • &
  • *
  • Both of the above
  • There are no such operators in C

Question 15

In C, two integers can be swapped using minimum
  • 0 extra variable
  • 1 extra variable
  • 2 extra variable
  • 4 extra variable

Question 16

What does the following statement do? C
 x  = x | 1 << n;
  • Sets x as 2n
  • Sets (n+1)th bit of x
  • Toggles (n+1)th bit of x
  • Unsets (n+1)th bit of x

Question 17

Predict the output of following C program 

C
#include <stdio.h>
int main()
{
    int i = 0;
    do
    {
        printf(\"GeeqsQuiz \");
        i = i++;
    }
    while (i < 5);
    return 0;
}
  • GeeqsQuiz GeeqsQuiz GeeqsQuiz GeeqsQuiz GeeqsQuiz

  • Infinite time GeeksQuiz

  • Undefined Behavior

  • None of the above

Question 18

Assume that the size of an integer is 4 bytes, predict the output of following program. C
#include <stdio.h>
int main()
{
    int i = 12;
    int j = sizeof(i++);
    printf(\"%d  %d\", i, j);
    return 0;
}
  • 12 4
  • 13 4
  • Compiler Error
  • 0 4

Question 19

C
#include<stdio.h>
int main()
{
  int a = 2,b = 5;
  a = a^b;
  b = b^a;
  printf(\"%d %d\",a,b);
  return 0;
}
  • 5 2
  • 2 5
  • 7 7
  • 7 2

Question 20

Predict the output of following program? 

C
#include <stdio.h>

int main() {
    int x = 10;
    int y = 20;
    x += (y += 10);
    printf("%d %d", x, y);
    return 0;
}
  • 40 20

  • 40 30

  • 30 30

  • 30 40

There are 41 questions to complete.

Last Updated :
Take a part in the ongoing discussion