Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
330 views
in Information Technology by (106k points)
closed by

What is the output of the following C program ?

#include <stdio.h>

void main (void)

{

int shifty;

shifty = 0570;

shifty = shifty >> 4;

shifty = shifty << 6;

printf("The value of shifty is %o \n" shifty);

}


1. The value of shifty is 15c0
2. The value of shifty is 4300
3. The value of shifty is 5700
4. The value of shifty is 2700

1 Answer

0 votes
by (106k points)
selected by
 
Best answer
Correct Answer - Option 4 : The value of shifty is 2700

The correct answer is option 4.

Initially shifty value is, shifty = 0570.

Here this function represents the a octal number as it starts with 0.

(0570)8 = (000 101 111 000)2

shifty = shifty >>4. //Right shift by 4 places.
shifty = (000 000 010 111)2
shifty = shifty <<6. //Left shift by 6 places:
shifty = (010 111 000 000)2
         = (2700)8

Hence the correct answer is The value of shifty is 2700.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...