Complete the code to assign 'out' to 'a' if 'sel' is 1, else 'b'.
assign out = sel ? [1] : b;The conditional operator syntax is condition ? true_value : false_value. Here, if sel is 1, out gets a.
Complete the code to assign 'result' to 8-bit zero if 'enable' is 0, else to 'data'.
assign result = enable ? [1] : 8'b0;
If enable is 1, result should be assigned data. Otherwise, it is zero.
Fix the error in the conditional assignment to 'flag'.
assign flag = (count > 10) ? [1] 1'b1 : 1'b0;
The conditional operator uses one '?' and one ':'. The code mistakenly has two '?'. The second '?' should be ':'.
Fill both blanks to assign 'out' to 'x' if 'sel' is 1, else 'y'.
assign out = [1] ? [2] : y;
The condition is sel. If true, assign x, else y.
Fill all three blanks to assign 'out' to uppercase 'ch' if 'enable' is 1 and 'ch' is a lowercase letter, else 'ch'.
assign out = (enable && (ch >= [1]) && (ch <= [2])) ? [3] : ch;
This checks if ch is between 'a' and 'z' (lowercase letters). If true and enable is 1, it converts ch to uppercase by subtracting 32 (assuming ASCII).
