Answer:
Following are the program in python language
def prob3_6(k): #function definition
c = 0 #variable declaration
while k != 1: #iterating the while loop
print(k) #print k
if k % 2 == 0:#check if condition
k= k // 2 #divisible by 2
else: #else condition
k = k * 3 + 1
c = c + 1
print(k) #print k
print c #print count
prob3_6(3)#function call
Output:
3
10
5
16
8
4
2
1
7
Explanation:
Following are the description of program
- Create a function "prob3_6" in this function we passing an integer parameter of type "int" named "k".
- Inside that function we declared a variable "c" of type "int" that is used for counting purpose .
- After that we iterated the while for print the value of when it is not equal to 1 .
- We check if condition when k gives 0 on modulus then k is divisible by 2 otherwise else block will be executed in the else part we multiply by 3 to k and add 1 to the k variable .
- Finally print "k" and "c"
Answer:
The correct answer to the following question will be "Operating system".
Explanation:
- An operating system is a machine software that handles hardware of a computer, computing assets and delivers basic services to software programs.
- It is an intermediary between such users and computer hardware.
- It also helps you to interact with your machine without learning how to use your language of the computer.
Therefore, it will be the right answer.
Answer:
Constructor in the class is the member function that gets into action when any new object gets created in the class ,it gets invoked. It does not have any return type and no void return.
The constructor is used in the class because there is the requirement for the initializing of the new object and then only object can do the functioning in the program.
Answer:
The correct answer to the following question is Drive-by hacking
.
Explanation:
Drive-by hacking is the type of hacking which comes under the cyberterrorism.
Drive-by hacking is the hacking where the hackers can access their data and steal their data, use their network services from some "safe" distance without going inside the company or an organization.
Drive-by download is the type of download of the malicious code into your mobile devices or the computers which occur by designed and it leave you to the cyberattack.