pin0-pin4-pin6-pin7

Please complete given code to set as an output only pin0-pin4-pin6-pin7 without changing other pins
Initial DDRD = 0x35;
void setup(){
DDRD = DDRD ……………………………………….
}

I couldn't find the mask of the number 0x35
00110101 is a binary ı know
but ı dont know mask

The question is ambiguous.
Pin 5 is currently an output pin.
Should it be left as an output pin because of the rule “ ... without changing other pins”
Or should it be changed to an input pin because of the rule stating that only 0, 4, 6 and 7 should be output pins.?

Don’t forget that the bit order is pin 7 first and pin 0 last. See: Arduino Reference - Arduino Reference
That is some tough homework you’ve got there.

The question is ambiguous. What was that ?

// calculate bit mask

void setup() {
    Serial.begin (9600);

    byte value;
    byte mask = 0;

    mask |=  1 << 0;    // bit 0
    mask |=  1 << 4;    // bit 4
    mask |=  1 << 6;    // bit 6
    mask |=  1 << 7;    // bit 7
    
    // to clr bits
    value  = 0xFF;
    value &= ~mask;

    Serial.println (value, HEX);

    // to set bits
    value  = 0;
    value |= mask;
    
    Serial.println (value, HEX);
}

void loop() {
}

this answer should be like

I have attached the picture

Imgur

11111.png

then you have your answer

11111.png

Do you understand what is pictured? Note that the three statements are NOT equivalent.

The first two statements set DDRD equal to the values shown, the values are identical, the first being in hexadecimal and the second in binary.

The third statement uses the |= operator, which takes the value on the left of the operator, DDRD, performs a logical OR with the value to the right of the operator, and stores the result in DDRD. (1<<x) takes a value of 1 and shifts it x bits to the left, so the code to the right of the |= is constructing a byte of data, with a 1 bit in the 6th, 4th, and 2nd bit positions, with bit position 1 being the rightmost bit (resulting in the same data used in the previous two statements, 0b00101010).

Okey ı understand but what is my answer