24UCS171 - Python Programming - Unit 1

45 flashcards · Programming Languages · by Sikkandhar Batcha J

  1. Which mode of Python allows you to type code and see results immediately?,Interactive mode,Script mode,Batch mode,Debug mode,A

  2. Which Python mode is better for writing large programs?,Script mode,Interactive mode,Single-line mode,Inline mode,A

  3. What is the file extension for Python scripts?,.py,.pyt,.pt,.p,A

  4. Which key combination exits Python interactive mode?,Ctrl+D,Ctrl+C,Ctrl+Z,Alt+F4,A

  5. Which command starts Python interactive shell?,python,py start,python shell,run python,A

  6. Which of the following is a popular Python IDE?,PyCharm,NetBeans,Eclipse,Visual Basic,A

  7. Which IDE comes pre-installed with Python?,IDLE,PyCharm,Jupyter,VS Code,A

  8. Jupyter Notebook is mainly used for?,Data Science,Game Development,Web Design,System Programming,A

  9. Which of these IDEs is web-based?,Jupyter Notebook,IDLE,PyCharm,VS Code,A

  10. Which IDE is lightweight and often used for quick Python scripting?,IDLE,Eclipse,NetBeans,Xcode,A

  11. Which of the following is NOT a numeric type in Python?,char,int,float,complex,A

  12. What is the output of type(10.0)?,float,int,complex,double,A

  13. Which data type is immutable?,Tuple,List,Dictionary,Set,A

  14. Which data type allows duplicate values?,List,Set,Dictionary,None,A

  15. Which data type stores key-value pairs?,Dictionary,Tuple,Set,List,A

  16. Which of the following is a valid Python variable name?,name_2,2name,name-2,name.2,A

  17. Which operator is used for exponentiation in Python?,**,^,//,exp,A

  18. What is the result of 7 // 2?,3,3.5,4,2,A

  19. Which operator is used for logical AND in Python?,and,&,AND,&&,A

  20. Which operator is used for membership checking?,in,is,==,has,A

  21. What is the result of 5 & 3?,1,7,2,0,A

  22. What is the result of 5 | 3?,7,1,2,0,A

  23. What is the result of 5 ^ 3?,6,7,2,1,A

  24. Which operator shifts bits to the left?,>,^,//,A

  25. Which operator inverts all bits?,~,!,not,^,A

  26. Which function is used to take input from the user?,input(),scanf(),read(),cin>>,A

  27. Which function is used to print output in Python?,print(),write(),echo(),printf(),A

  28. What is the default type of input() value?,str,int,float,bool,A

  29. How do you print without a newline at the end?,print(..., end=''),print(..., stop=''),printline(...),print.noend(...),A

  30. Which method is used for formatted output?,format(),printf(),sprintf(),fprint(),A

  31. What will be the output of print('Hello %s' % 'World')?,Hello World,Hello,Hello %s,Error,A

  32. Which is the modern way of formatting strings in Python?,f-strings,format(),concat(),join(),A

  33. f-strings were introduced in which Python version?,3.6,2.7,3.0,3.8,A

  34. What is the output of print(f'{10/3:.2f}')?,3.33,3.333,3.3,Error,A

  35. Which operator is overloaded by the '+' symbol in Python?,Concatenation,Multiplication,Division,Subtraction,A

  36. Strings in Python are?,Immutable,Mutable,Volatile,Dynamic,A

  37. Which method is used to convert string to lowercase?,lower(),tolower(),str.lower(),down(),A

  38. Which of the following slices the string s='Python' to 'Pyt'?,s[:3],s[:2],s[0:2],s[1:3],A

  39. Which operator is used for string repetition?,*,+,x,repeat(),A

  40. What is the output of 'Python'[::-1]?,nohtyP,Python,Error,htypno,A

  41. Which method is used to add an element to a list?,append(),insert(),add(),push(),A

  42. Which of the following removes and returns the last element of a list?,pop(),remove(),delete(),discard(),A

  43. Which method is used to add an element to a set?,add(),append(),insert(),push(),A

  44. Dictionaries do not allow?,Duplicate keys,Duplicate values,Nested dictionaries,Any values,A

  45. Which data type is ordered and changeable?,List,Tuple,Set,Dictionary,A