Computer Science › Boolean
Consider the code below:
int[] vals = {841,-14,1,41,49,149,14,148,14};
boolean[] bools = new boolean[vals.length];
for(int i = 0; i < vals.length; i++) {
bools[i] = vals[i] > 20 && vals[i] % 2 == 0;
}
for(int i = 0; i < bools.length; i++) {
if(bools[i]) {
System.out.println(vals[i]);
}
}
What is the output of the code above?
Convert the decimal number 67 to binary.
In the following equation, considering the boolean
variables x
, y
, and z
, which of the following combinations of values will evaluate to true
?
(x\,\&\&\,!y)\,||\,((!x\,||\,z)\,\&\&\,!(y\,||\,z))
How do we set a method to return a Boolean in Swift(iOS)?
int j=6;
int k=0;
int l=2;
int c = (j|k) & l;
What is the value of c?
#include
using namespace std;
bool bigger(int x, int y)
{
if (x>y)
return true;
else
return false;
}
int main()
{
bool test;
test!=bigger(10,7);
cout<<test;
}
What will be the value of test after the previous code is run?
In Swift (iOS), define an unwrapped boolean.