Page 1 of 1

9. Given this piece of code fragment: (10%) for (int x = 0; x < 10; x++) { if ( x % 4 >= 2) cout << "OK" << endl; } Assu

Posted: Sat Nov 27, 2021 2:15 pm
by answerhappygod
9 Given This Piece Of Code Fragment 10 For Int X 0 X 10 X If X 4 2 Cout Ok Endl Assu 1
9 Given This Piece Of Code Fragment 10 For Int X 0 X 10 X If X 4 2 Cout Ok Endl Assu 1 (29.97 KiB) Viewed 62 times
9. Given this piece of code fragment: (10%) for (int x = 0; x < 10; x++) { if ( x % 4 >= 2) cout << "OK" << endl; } Assuming the branch prediction by default is "TAKEN”, (1) What is the accuracy of branch prediction of the cout statement when we use a 1-bit branch history? (2) What is the accuracy of branch prediction of the cout statement when we use a 2-bit branch history?