BUS104 Python Exam Questions and Answers 100% Pass
BUS104 Python Exam Questions and Answers 100% Pass Python interpreter - Correct Answer️️ -The Python interpreter is a computer program that executes code written in the Python programming language. What is the difference between code and a program? - Correct Answer️️ -Code is a set of instructions, while a program is a collection of code that performs a specific task. What is computational thinking, and why is it essential in coding? - Correct Answer️️ - Computational thinking is a problem-solving approach. It is essential in coding as it helps break down complex problems into smaller, manageable steps. What is an algorithm, and why is it important in coding? - Correct Answer️️ -An algorithm is a step-by-step procedure to solve a problem. It is important in coding as it provides a systematic approach to problem-solving. What are the differences between block comments and inline comments? - Correct Answer️️ -Block comments are multi-line comments, while inline comments are single- line comments. Block comments are used to provide detailed explanations, while inline comments are used for brief annotations. Which function in Python allows you to output information to the user? - Correct Answer️️ -print() function What are valid variable names in Python, and what are some examples? - Correct Answer️️ -Valid variable names can contain letters, numbers, and underscores. Examples: my_variable, num1, total_sum.PDF DOCUMENT What convention will we follow when creating variable names? - Correct Answer️️ - Snake case convention (lowercase with underscores) What operator is used for string concatenation? - Correct Answer️️ -The + operator Which function allows the user to provide information to your program? - Correct Answer️️ -input() function What is the difference between the print function and the input function? - Correct Answer️️ -Print function outputs information, while input function takes user input. What are some key considerations when using the input function in Python to ensure expected user responses? - Correct Answer️️ -Validating user input, handling exceptions, and providing clear instructions. Data types: letter, whole numbers, decimals What would the result of the expression 5 + 3 * 2 be? - Correct Answer️️ -11 What is the modulo operator? What is its purpose? - Correct Answer️️ -%= Returns the remainder of a division operation. How would you round 2.346 to one decimal place? How do you round it to the nearest whole number? - Correct Answer️️ -1 decimal place: 2.3, Nearest whole number: 2 How would you get access to the trunc function? - Correct Answer️️ -By importing the math module. What are the shortcut operators in Python? List them. - Correct Ans
Written for
- Institution
- Python Programming
- Course
- Python Programming
Document information
- Uploaded on
- June 17, 2024
- Number of pages
- 9
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
bus104 python exam questions and answers 100 pass
Also available in package deal