• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

C Operators

Question 31

Write the output of the following C program C
#include <stdio.h>

  int main (void)
  {
  int shifty;
  shifty = 0570;
  shifty = shifty >>4;
  shifty = shifty <<6;
  printf(\"the value of shifty is %o\",shifty);
  }
  • the value of shifty is 15c0
  • the value of shifty is 4300
  • the value of shifty is 5700
  • the value of shifty is 2700

Question 32

The following three \'C\' language statements is equivalent to which single statement? y=y+1; z=x+y; x=x+1
  • z = x + y + 2;
  • z = (x++) + (++y);
  • z = (x++) + (y++);
  • z = (x++) + (++y) + 1;

Question 33

Given i = 0, j = 1, k = –1 x = 0.5, y = 0.0 What is the output of the following expression in C language ? x * y < i + j || k
  • -1
  • 0
  • 1
  • 2

Question 34

Loop unrolling is a code optimization technique:
  • that avoids tests at every iteration of the loop.
  • that improves performance by decreasing the number of instructions in a basic block.
  • that exchanges inner loops with outer loops
  • that reorders operations to allow multiple computations to happen in parallel

Question 35

Output of following C++ code will be?

C++
#include <iostream>
using namespace std;

class X 
{
public:
    int x;
};

int main()
{
    X a = {10};
    X b = a;
    cout << a.x << " " << b.x;
    return 0;
}
  • Compiler Error

  • 10 followed by Garbage Value

  • 10 10

  • 10 0

Question 36

Output of following program? 
 

C++
#include <iostream>
using namespace std;

class Point {
    Point() { cout << "Constructor called"; }
};

int main()
{
    Point t1;
    return 0;
}
  • Runtime Error

  • None of these

  • Constructor called

  • Compiler Error

Question 37

Given that x = 7.5, j = -1.0, n = 1.0, m = 2.0 the value of - - x + j == x>n> = m is: 
 

  • 0
     

  • 1
     

  • 2
     

  • 3
     

Question 38

If n has 3, then the statement a[++n]=n++;
 

  • assigns 3 to a[5]
     

  • assigns 4 to a[5]
     

  • assigns 4 to a[4]
     

  • what is assigned is compiler dependent
     

Question 39

#include "stdio.h"

int main() 

{ 

  int x, y = 5, z = 5; 

  x = y == z; 

  printf("%d", x); 

  

  getchar(); 

  return 0; 

}
  • 0
     

  • 1
     

  • 5
     

  • Compiler Error
     

Question 40

C
#include <stdio.h>
int main()
{
    int i = 3;
    printf(\"%d\", (++i)++);
    return 0;
}

What is the output of the above program?
 

  • 3
     

  • 4
     

  • 5
     

  • Compile-time error
     

There are 41 questions to complete.

Last Updated :
Take a part in the ongoing discussion