Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Fill in the mask and operation to perform the masking operation called for a) Fo

ID: 3789666 • Letter: F

Question

Fill in the mask and operation to perform the masking operation called for

a) Force bit 3 high PORTB __=   ___________;    

b) Force bit 1 low PORTB __=   ___________;     

c) Force bit 5 high PORTB __=   ___________;     

d) Toggle bit 6 PORTB __=   ___________;

For what values of the integer k, will the function "Test" execute?

e)    if( k ) {         // Will execute if k ______________________     Test(); }   

f) if( k > 5 && k < 10) {         // Will execute if k ______________________     Test(); }  

g)    if( k & 0x0020) {         // Will execute if bit ____ in k is a ____     Test();

Explanation / Answer

Assumption is bit counting starts from 0 (LSB)


a) Force bit 3 high PORTB __=   ___________; PORTB |= 1<<3   

b) Force bit 1 low PORTB __=   ___________;   PORTB &= ~(1 << 1);

c) Force bit 5 high PORTB __=   ___________; PORTB |= 1<<5   

d) Toggle bit 6 PORTB __=   ___________; PORTB ^= 1 << 6;

For what values of the integer k, will the function "Test" execute?

e)    if( k ) {         // Will execute if k _____is not equal to 0_________________     Test(); }   

f) if( k > 5 && k < 10) {         // Will execute if k _____if k is greater than 5 and less than 10_______     Test(); }

g)    if( k & 0x0020) {         // Will execute if bit __5__ in k is a _high___     Test();

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote