Question
Asked Oct 29, 2019

Consider the following code. What will be printed out by the code?

int main {
char c
11
char d
12
printf("%d %d \n", c, d);
printf ("%d \n"
printf ("%d \n",
c & d)
d);
C
unsigned char n
printf("%d %d \n", n, c);
unsigned char m = d << 2;
printf ("%d %d \n", m, d)
C >3;
help_outline

Image Transcriptionclose

int main { char c 11 char d 12 printf("%d %d \n", c, d); printf ("%d \n" printf ("%d \n", c & d) d); C unsigned char n printf("%d %d \n", n, c); unsigned char m = d << 2; printf ("%d %d \n", m, d) C >3;

fullscreen
check_circleExpert Solution
Step 1

Implementing the given program code in a class to get the output and modifying some output statements so that the code can be understandable easily:

 

//header file

#include <stdio.h>

//main method

int main()

{

   //declaring variables

    char c=11;

    char d=12;

    //displaying value of c and d to user

    printf(" value of c and d: %d %d \n",c,d);

    //performing bitwise and operation in the c&d

    printf("using bitwise and on c&d %d  \n",c&d);

    //performing bitwise or operation in the c|d

    printf("using bitwise or on c|d %d \n", c|d);

    //using right shift and storing the result in n

    unsigned char n=c>>3;

    //displaying the value of n and c

    printf("displaying value of n and c: %d %d \n",n ,c);

    //using left shift and storing the result in m

    unsigned char m=d<<2;

    //displaying the value of n and c

    printf("displaying value of m and d: %d %d \n",m ,d);

    return 0;

}

 

Step 2

Output of the given program code:

value of c and d: 11 12
using bitwise and on ced 8
using bitwise or on cld 15
displaying value of n and c: 1 11
displaying value of m and d: 48 12
help_outline

Image Transcriptionclose

value of c and d: 11 12 using bitwise and on ced 8 using bitwise or on cld 15 displaying value of n and c: 1 11 displaying value of m and d: 48 12

fullscreen
Step 3

Explanation of the above given code statements:

The output:

                      Using bitwise and on c&d    8

Is gener...

decimal number
binary number
11
1011
C
12
1100
help_outline

Image Transcriptionclose

decimal number binary number 11 1011 C 12 1100

fullscreen

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour*

See Solution
*Response times may vary by subject and question
Tagged in

Engineering

Computer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add
question_answer

Q: What are the SQL commands to create TABLE BOOK, that includes  both primary and foreign keys, with t...

A: Primary key:A PRIMARY KEY is used to uniquely define every tuple in a table. The PRIMARY KEY imposes...

question_answer

Q: Write a program in Java Eclipse that does the following:a) create a 2D Ragged array with columns and...

A: Create a Main class and all required methods to print Ragged array elements. And create all methods ...

question_answer

Q: What are the different computer languages? Give a brief description of each.

A: DefinitionLanguage is the basic way of communication between the computer systems and to communicate...

question_answer

Q: Which one of the following is NOT true with arc implementation of the super- and sub-typeentitiesA) ...

A: When the subtypes were modeled as standalone entities with each one having as is subtype of or is su...

question_answer

Q: Arrays Write three statements to print the first three elements of array runTimes. Follow each state...

A: Note: As the user given index value is constant and so the value of index will not be changed while ...

question_answer

Q: Please help me with this, I'm stuck...

A: The DFA is a 5- tuple {Q, ∑, q, F, δ}:Q = {q0, q1, q2, q3, q4}∑ = w | w is a string over {a, b} that...

question_answer

Q: Write a program TwoSmallest.java that takes a set of double command-line arguments and prints the sm...

A: Create a class and main method and in the main method declare all required variables to find the fir...

question_answer

Q: program3_1.pyShipping is free for online orders totaling $25 or more at Mississippi.com. Orders less...

A: round() function is used to round the number.Syntax of round function:round(number [, ndigit])number...

question_answer

Q: What challenges did Cisco systems face in order to solve the physical security problems?

A: Click to see the answer