Python Programming Exam Questions and Solutions, Exams of Advanced Education

A set of exam questions related to python programming, covering fundamental concepts such as data types, string manipulation, operators, control flow, and list operations. Each question is accompanied by a complete solution, making it a valuable resource for students preparing for exams or seeking to reinforce their understanding of python basics. The questions range from basic syntax to more complex operations, offering a comprehensive review of essential python knowledge. This resource is designed to help learners test their knowledge and improve their problem-solving skills in python programming. It includes questions on data types, string manipulation, operators, control flow, and list operations.

Typology: Exams

2024/2025

Available from 11/16/2025

guidedexam
guidedexam 🇺🇸

2.5

(2)

6.9K documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Python Part 1 Exam Questions (1-65) ,
with Complete Solutions
1. What is the output of print(list[2:]) if list=[ 'abcd',786, 2.23]? - ANSWERS-
[2.23]
2. What is the output of print (tinylist * 2) if tinylist = [123, 'john']? -
ANSWERS-[123, 'john',123, 'john']
3. Which of the following is correct about tuples in Python? - ANSWERS-***
4. What is the output of print(myTuple) if myTuple = ('abcd',786,2.23)? -
ANSWERS-('abcd',786,2.23)
5. What is the output of print(myTuple[1:3]) if myTuple=('abcd',786,2.23)? -
ANSWERS-(786, 2.23)
6. What is the output of print (myTuple[0]) if myTuple = ('abcd',786,2.23)? -
ANSWERS-abcd
7. Which function obtains all the keys from a dictionary? - ANSWERS-keys()
8. Which function obtains all the values from a dictionary? - ANSWERS-
values()
9. Which function converts a string to an int ? - ANSWERS-int("string")
pf3
pf4
pf5

Partial preview of the text

Download Python Programming Exam Questions and Solutions and more Exams Advanced Education in PDF only on Docsity!

Python Part 1 Exam Questions (1-65) ,

with Complete Solutions

  1. What is the output of print(list[2:]) if list=[ 'abcd',786, 2.23]? - ANSWERS- [2.23]
  2. What is the output of print (tinylist * 2) if tinylist = [123, 'john']? - ANSWERS-[123, 'john',123, 'john']
  3. Which of the following is correct about tuples in Python? - ANSWERS-***
  4. What is the output of print(myTuple) if myTuple = ('abcd',786,2.23)? - ANSWERS-('abcd',786,2.23)
  5. What is the output of print(myTuple[1:3]) if myTuple=('abcd',786,2.23)? - ANSWERS-(786, 2.23)
  6. What is the output of print (myTuple[0]) if myTuple = ('abcd',786,2.23)? - ANSWERS-abcd
  7. Which function obtains all the keys from a dictionary? - ANSWERS-keys()
  8. Which function obtains all the values from a dictionary? - ANSWERS- values()
  9. Which function converts a string to an int? - ANSWERS-int("string")
  1. Which function converts a string to a float? - ANSWERS-float("string")
  2. Which of the following data types are supported in Python? - ANSWERS- The following data type are Supported: 1 - Numbers 2 - String 3 - List 4 - Tuples 5 - Dictionary
  3. Which of the following data types are not supported in Python? - ANSWERS-Slice
  4. What is the output of print(str) if str = 'Hello World!'? - ANSWERS-Hello World!
  5. What is the output of print(str[0]) if str = 'Hello World!'? - ANSWERS-H
  6. What is the output of print(str[2:5]) if str = 'Hello World!'? - ANSWERS-llo
  7. What is the output of print(str[2:]) if str = 'Hello World!'? - ANSWERS-llo World!
  8. What is the output of print(str * 2) if str = 'Hello World!'? - ANSWERS- Hello World!Hello World!
  9. What is the output of print(list) if list=[ 'abcd', 786 , 2.23]? - ANSWERS- ['abcd', 786 , 2.23]
  1. Which operator evaluates True when operands refer to the same object? - ANSWERS-== or is
  2. Which operator evaluates True if it does not find a variable sequence? - ANSWERS-not in
  3. Which statement stops and transfers to the statement after the loop? - ANSWERS-break
  4. Which statement skips the loop & retests prior to reiterating? - ANSWERS-continue
  5. Which statement is used when when you do not want any code to execute? - ANSWERS-exit() or pass()
  6. Which function returns a random item from a list, tuple, or string? - ANSWERS-random.choice()
  7. Which function returns a randomly selected element from range? - ANSWERS-random.randrange()
  8. Which function returns a random float between 0 and 1? - ANSWERS- random.random()
  9. Which function sets the starting value in generating random numbers? - ANSWERS-seed([x])
  10. Which function randomizes the items of a list in place? - ANSWERS- random.shuffle()
  1. Which function capitalizes first letter of string? - ANSWERS-title()
  2. Which function checks in a string that all characters are alphanumeric? - ANSWERS-isalnum()
  3. Which function checks in a string that all characters are digits? - ANSWERS-isdigit()
  4. Which function checks in a string that all characters are in lowercase? - ANSWERS-islower()
  5. Which function checks in a string that all characters are numeric? - ANSWERS-isnumeric()
  6. Which function checks in a string that all characters are whitespaces? - ANSWERS-isspace()
  7. Which function checks in a string that all characters are titlecased? - ANSWERS-istitle()
  8. Which function checks in a string that all characters are in uppercase? - ANSWERS-isupper()
  9. Which function merges elements in a sequence? - ANSWERS-join(seq)
  10. Which function obtains the length of the string? - ANSWERS-len()
  1. What is the function that returns the lowest index in list? - ANSWERS- list.index(obj)
  2. What is the function that inserts an object at given index in a list? - ANSWERS-list.insert(index,obj)
  3. What is the function that removes last object from a list? - ANSWERS- list.pop(obj=list[-1])
  4. What is the function that removes an object from a list? - ANSWERS- list.remove(obj)