Answer:
public class Digits
{
public static boolean allDigitsOdd(int num)
{
boolean flag=true;
int rem;
while(num>0)
{
rem=num%10;
num=num/10;
if(rem%2==0) // if a even digit found immediately breaks out of loop
{
flag=false;
break;
}
}
return flag; //returns result
}
public static void main(String args[])
{
System.out.println(allDigitsOdd(1375)); //returns true as all are odd digits
}
}
OUTPUT :
true
Explanation:
Above program has 2 static methods inside a class Digits. Logic behind above function is that a number is divided by 10 until it is less than 0. Each time its remainder by 0 is checked if even immediately breaks out of the loop.
Answer:
B. False
Explanation:
External security threat can be defined as any threats coming outside the company's computer network operation, usually carried out with negative or hostile intent for the purpose of stealing information or distracting the flow of operation. For example, Virus Attack
However, given that the question talked about the "management failure to support organization-wide security awareness, inadequate security policies, and unenforced security procedures."
Hence, this is not an External Security Threat, which means, the correct answer is FALSE.
Answer:
Part a: The program will print 3.
Part b: The program will print 4
Part c: The program will print 1.
Explanation:
Part a: As the scoping is static, the x integer has a value of 1 and the y integer has a value of 2 so the addition is 2+1=3.
Part b: As the scoping is dynamic with deep binding, the x integer has a value of 2 and the y integer has a value of 2 so the addition is 2+2=4.
Part c: As the scoping is dynamic with shallow binding, the x integer has a value of 1 so it will print 1.