Question

Question 34 CLO2 Identify the output of the following code. Х=2 х=X+3 x=x2 print (6) ОООО
Question 35 CLO2 Below is a function definition: def Details(name, increase): print (name, you have received an increase of
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) Code:

X=2

x=X+3

x=x**2

print(X)

Output:

2

Explanation:

As we know python is a case-sensitive language, in the above code we have used two variables - (X, x).

In the first line X value is set to 2.

In the second and third lines we have set the value of x.

In fourth line we just print X's value, which is initially declared as 2 and never changed.

So the output is 2.

2) Code:

def Details(name,increase):

print(name,",you have recieved an increase of",increase,"Dhs")

Answer:

Details("Salem",1000)

Explanation:

Option a) Details("Salem",1000) - Correct, name of the method is matching and parameters of the method are proper like, salem is given as first parameter and 1000 is given as second paramater.

Option b) details("Salem",1000) - Incorrect, name of the method is not matching (d is small case in details).

Option c) Details(1000,"Salem") - Incorrect, name of the method is matching but the input parameters are not as declaration method, number value is provided at string and string value is provided at number.

Option d) details(1000,"Salem") - Incorrect, name of the method is not matching (d is small case in details) and also the input parameters are not as declaration method, number value is provided at string and string value is provided at number.

Please comment if you have any questions and thumbs up if you like the answer.

Thank you.

Add a comment
Know the answer?
Add Answer to:
Question 34 CLO2 Identify the output of the following code. Х=2 х=X+3 x=x2 print (6) ОООО...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Mele!!! Question 24 2 pts What is the output of the following code: def XXX(array,y): X...

    Mele!!! Question 24 2 pts What is the output of the following code: def XXX(array,y): X = for i in range (y): x += array[i] print (x) list=[10,20,30] XXX(list, 3) 60 N 3 0

  • Question 116 pts (TCO 2) What is the output of the following code?                         void func(int...

    Question 116 pts (TCO 2) What is the output of the following code?                         void func(int x)                         {                                     x = x * 2;                         } int main( ) {         int x = 10;         func(x);         cout << x << endl; } 20 30 10 5 Question 126 pts (TCO 2) A derived class is typically an example of _____. a “has a” relationship an “is a” relationship a “uses a” relationship an “is used” relationship Question...

  • + Run C Code IMPORTANT: • Run the following code cell to create the input file,...

    + Run C Code IMPORTANT: • Run the following code cell to create the input file, biostats.csv, which you will be using later. 74, In [ ]: N %%file biostats.csv Name, Sex, Age, Alex, M, 41, Bert, M, 42, Dave, M, 39, Elly, F, 30, Fran, F, 33, Jake, M, F, Luke, M, 34, F Myra, M, M, 38, Ruth, F, 28, 22 22 323 47 47, Height, Weight 170 200 167 70 115 143 139 280 98 75, 350...

  • Python 3 Question Do NOT use global variables (This is an edit to a question I've...

    Python 3 Question Do NOT use global variables (This is an edit to a question I've asked before because I forgot to include a template. So if you have answered this question already I ask that you do not copy and paste a previous answer.) PLEASE use the template given, keep the code introductory friendly, and include comments. Many thanks. Prompt: The results of a survey of the households in your township are available for public scrutiny. Each record contains...

  • Designing functions Reminder: When designing functions, follow the given steps to reinforce good software development p...

    Designing functions Reminder: When designing functions, follow the given steps to reinforce good software development practices and problem solving strategies: a) Start by writing the documentation for the function. Use docstrings shown in lecture and lab. b) Write test calls to the function in your main function for the different cases of input the function will encounter. This will help you understand the behavior of the function and later behave as tests for your function. c) Define the function d)...

  • Question 2 - Programming Exercise 1. Make a directory for this lab and change into it....

    Question 2 - Programming Exercise 1. Make a directory for this lab and change into it. 2. Copy files using the following command: cp/net/data/ftp/pub/class/115/ftp/cpp/Inheritance/Exercise.cpp Exercise.cpp Finish the program so that it compiles and runs. The instructions are contained in the C++ file. Your completed program should generate output similar to the following: TwoD default constructor This program asks for the coordinates of two points in 3D space and calculates their distance. Please enter the xyz coordinates for the first point:...

  • DI Question 2 1.5 pts Which situations allow the client main() in the file my_program.py to access a method name, say f...

    DI Question 2 1.5 pts Which situations allow the client main() in the file my_program.py to access a method name, say func(), alone, as in x-func) without dereferencing it using prepended name like modname.func or x = some object. func () or x-SomeClass.func() O func) is defined in some module, say, "modname.py" and modname is imported into my_program.py using: from modname import func() is an instance method or a class method in a class, say SomeClass, defined in the same...

  • These are my answere to the following questions: are they right? 1. B 2. T 3....

    These are my answere to the following questions: are they right? 1. B 2. T 3. T 4. T 5. F 6. T 7. A 8. D 9. E 10. B 11. B 12. A 13. A 14. D 15. C 16. D 17. T 18. C 19. T 20. T 21. T 22. A 23. T 24. D 25. B 26. A 27. A 28. A 29. T 30. C 31. D 32. A 33. T 34. F 35....

  • Assignment 2 In this assignment, you will write two short programs to solve problems using recursion....

    Assignment 2 In this assignment, you will write two short programs to solve problems using recursion. 1. Initial Setup Log in to Unix. Run the setup script for Assignment 2 by typing: setup 2 2. Towers of Hanoi Legend has it that in a temple in the Far East, priests are attempting to move a stack of disks from one peg to another. The initial stack had 64 disks threaded onto one peg and arranged from bottom to top by...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT