Daily iOS
CS fundamentals and algorithms

Bit operations and OptionSet

Given this code, which statements about OptionSet and bit operations are correct? Select all that apply.

struct Perm: OptionSet {
    let rawValue: UInt8
    static let read  = Perm(rawValue: 1 << 0)
    static let write = Perm(rawValue: 1 << 1)
    static let exec  = Perm(rawValue: 1 << 2)
}
let p: Perm = [.read, .write]

Pick all that apply

Submit