Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Is Python case sensitive when dealing with identifiers? a) yes b) no c) machine dependent d) none of the mentioned 2. What is the maximum

  1. Is Python case sensitive when dealing with identifiers? a) yes b) no c) machine dependent d) none of the mentioned
  2. 2. What is the maximum possible length of an identifier? a) 31 characters b) 63 characters c) 79 characters d) none of the mentioned
  3. 3. Which of the following is invalid? a) _a = 1 b) __a = 1 c) __str__ = 1 d) none of the mentioned
  4. Which of the following is an invalid variable? a) my_string_1 b) 1st_string c) foo d) _
  5. 5. Why are local variable names beginning with an underscore discouraged? a) they are used to indicate a private variables of a class b) they confuse the interpreter c) they are used to indicate global variables d) they slow down execution
  6. 6. Which of the following is not a keyword? a) eval b) assert c) nonlocal d) pass
  7. 7. All keywords in Python are in a) lower case b) UPPER CASE c) Capitalized d) None of the mentioned
  8. 8. Which of the following is true for variable names in Python? a) unlimited length b) all private members must have leading and trailing underscores c) underscore and ampersand are the only two special characters allowed d) none of the mentioned
  9. 9. Which of the following is an invalid statement? a) abc = 1,000,000 b) a b c = 1000 2000 3000 c) a,b,c = 1000, 2000, 3000 d) a_b_c = 1,000,000
  10. 10. Which of the following cannot be a variable? a) __init__ b) in c) it d) on

  1. 11. Which of these in not a core data type? a) Lists b) Dictionary c) Tuples d) Class

  1. Given a function that does not return any value, What value is thrown by default when executed in shell. a) int b) bool c) void d) None

  1. Following set of commands are executed in shell, what will be the output?

>>> str="hello"

>>> str[:2]

'he'

  1. 14. Which of the following will run without errors ? a) round(45.8) b) round(6352.898,2,5) c) round() d) round(7463.123,2,1)
  2. In python we do not specify types,it is directly interpreted by the compiler, so consider the following operation to be performed.
Command: >>>x = 13 ? 2

objective is to make sure x has a integer value, select all that apply (python 3.xx) a) x = 13 // 2 b) x = int(13 / 2) c) x = 13 % 2 d) All of the mentioned

  1. What error is displayed when you type the following command?

Apple = mango

  1. SyntaxError b) NameError c) ValueError d) TypeError
  1. Note: Reference : Perform Exercises provided in the following URL

https://www.w3schools.com/python/python_lists.asp

  1. What data type is the object below ? L = [1, 23, hello, 1]. a) list b) dictionary c) array d) tuple
  2. Write the output of the following Python code.

Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license()" for more information.

>>> grade1= 80

>>> grade2 = 95

>>> sum = grade1+grade2

>>> avg = sum/2

>>> print(avg)

Answer : ______________________________________________

  1. Select all options that print hello-how-are-you a) print(hello, how, are, you) b) print(hello, how, are, you + - * 4) c) print(hello- + how-are-you) d) print(hello + - + how + - + are + you)

e) print("hello"+"-"+"how"+"-"+"are"+"-"+"you")

Answer : __________________________

Section 2 will test your knowledge on basic operators

  1. Which is the correct operator for power(xy)? a) X^y b) X**y c) X^^y d) None of the mentioned
  2. 2. Which one of these is floor division? a) / b) // c) % d) None of the mentioned
  3. What is the order of precedence in python? i) Parentheses ii) Exponential iii) Multiplication iv) Division v) Addition vi) Subtraction a) i,ii,iii,iv,v,vi b) ii,i,iii,iv,v,vi c) ii,i,iv,iii,v,vi d) i,ii,iii,iv,vi,v
  4. 4. What is answer of this expression, 22 % 3 is? a) 7 b) 1 c) 0 d) 5
  5. Mathematical operations can be performed on a string. State whether true or false. a) True b) False
  6. 6. Operators with the same precedence are evaluated in which manner? a) Left to Right b) Right to Left c) Cant say d) None of the mentioned
  7. What is the output of this expression, 3*1**3? a) 27 b) 9 c) 3 d) 1
  8. 8. Which one of the following have the same precedence? a) Addition and Subtraction b) Multiplication and Division c) Both Addition and Subtraction AND Multiplication and Division d) None of the mentioned
  9. 9. The expression Int(x) implies that the variable x is converted to integer. State whether true or false. a) True b) False
  10. 10. Which one of the following have the highest precedence in the expression? a) Exponential b) Addition c) Multiplication d) Parentheses

Section 3 Numeric types

1.

What is ouput of the following command?

>>> print(0.1+0.2==0.3)

Answer: _______________________________________________

2. 2. Which of the following is not a complex number? a) k = 2 + 3j b) k = complex(2, 3) c) k = 2 + 3l d) k = 2 + 3J

3. 3. What is the type of inf? a) Boolean b) Integer c) Float d) Complex

4. Which of the following is incorrect? a) x = 0b101 b) x = 0x4f5 c) x = 19023 d) x = 03964

5. Which of the following is incorrect? a) float(inf) b) float(nan) c) float(56+78) d) float(12+34)

6. write down answer of the following command

round(0.5)-round(-0.5)

Answer :___________________________

7. write down answer of the following command

>>> x=3^4

>>> print(x)

Answer _______________________________________

Section 4- Precedence and Associativity

>>> a = 4/(3*(2-1))

>>> b=4/3*(2-1)

Are both the expressions equal?

  1. What is the output?

>>> c = 4 + 3 % 5

>>> print(c)

Answer: ______________________________

  1. Write the output for below commands.

>>> a = 16

>>> b = 15

>>> c = a%b//a

>>> print(c)

Answer: _____________________________________

  1. Which of the following operators has its associativity from right to left?

a) + b) // c) % d) **

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions

Question

I receive useful feedback about my performance.

Answered: 1 week ago

Question

I am encouraged to offer opinions/suggestions.

Answered: 1 week ago