Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Loading...
User Settings
close menu
Welcome to Scribd!
Upload
Read for free
FAQ and support
Language (EN)
Sign in
0 ratings
0% found this document useful (0 votes)
39 views
Python MCQ
Uploaded by
siddheshverma0912
S9ysitsitsisgo
Copyright:
© All Rights Reserved
Available Formats
Download
as PDF or read online from Scribd
Download
Save
Save Python MCQ For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Python MCQ
Uploaded by
siddheshverma0912
0 ratings
0% found this document useful (0 votes)
39 views
6 pages
Document Information
click to expand document information
S9ysitsitsisgo
Copyright
© © All Rights Reserved
Available Formats
PDF or read online from Scribd
Share this document
Share or Embed Document
Sharing Options
Share on Facebook, opens a new window
Facebook
Share on Twitter, opens a new window
Twitter
Share on LinkedIn, opens a new window
LinkedIn
Share with Email, opens mail client
Email
Copy link
Copy link
Did you find this document useful?
0%
0% found this document useful, Mark this document as useful
0%
0% found this document not useful, Mark this document as not useful
Is this content inappropriate?
Report
S9ysitsitsisgo
Copyright:
© All Rights Reserved
Available Formats
Download
as PDF or read online from Scribd
Download now
Download as pdf
Save
Save Python MCQ For Later
0 ratings
0% found this document useful (0 votes)
39 views
6 pages
Python MCQ
Uploaded by
siddheshverma0912
S9ysitsitsisgo
Copyright:
© All Rights Reserved
Available Formats
Download
as PDF or read online from Scribd
Save
Save Python MCQ For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download as pdf
Jump to Page
You are on page 1
of 6
Search inside document
Fullscreen
Python MCQ (Multi Choice Questions) Q What is the maximum possible length of an identifier? a. 16 b, 32 c. 64 d. None of these above Answer: (d) None of these above Explanation: The maximum possible length of an identifier is not defined in the python language. It can be of any number, Q. Who developed the Python language? a. ZimDen b. Guido van Rossum ©. Niene Stom d. Wick van Rossum Answer: (b) Guido van Rossum Explanation: Python language was developed by Guido van Rossum in the Netherlands. Q In which year was the Python language developed? a 1995 b. 1972 c. 1981 d. 1989 Answer: (d) 1989 Explanation: Python language was developed by Guido van Rossum in 1989. Q In which language is Python written? a. English b. PHP « C d. All of the above Answer: (b) C Explanation: Python is written in C programming language, and it is also called CPython. Q. Which one of the following is the correct extension of the Python file? PY b. python cP d. None of these the correct extension of the Python file. Q In which year was the Python 3.0 version developed? a 2008 b. 2000 c. 2010 d. 2005 Answer: (a) 2008 Explanation: Python 3.0 version was developed on December 3, 2008.yeepe Q. What do we use to define a block of code in Python language? a Key b. Brackets ¢. Indentation 4d. None of these Answer: (c) Indentation Explanation; Python uses indentation to define blocks of code. Indentations are simply spaces or tals used as an indicator that is part of the indent code child. As used in curly braces C, C++, and Java. Q Which character is used in Python to make a single line comment? a bo c # a! Answer: (c) # Explanation: Q Which of the following statements is correct regarding the object-oriented programming concept in Python’? a, Classes are real-world entities while objects are not real b. Objects are real-world entities while classes are not real c, Both objects and classes are real-world entities d. Allof the above “#" character is used in Python to make a single-line comment. Answer: (b) Objects are real-world entities while classes are not real Explanation: None Q. Which of the following statements is correct in this python code? ‘class Name: javajavaipoint = java 8. It will throw the error as multiple references to the same object is not possible b. id(name!) and id(name2) will have same value ¢. Both name! and name? will have reference to two different objects of class Name 4d. Allof the above Answer: (b) id(name! ) and id(name2) will have same value ‘name1" and "name2" refer ta the same object, so id(name!) and id(name2) will have ‘the same value, Q What is the method inside the class in python language? a Object, b. Function cc, Attribute: d. Argument Answer: (b) Function Explanation: Function is also known as the method.Q. Which of the following operators is the correct option for powertab)? a at b. ab ce. ahhh di at*b Answer: (b) a*b Explanation: The power operator in python is a**b, ic, 2**3=8, Q. Which of the following precedence order is correct in Python? 4. Parentheses, Exponential, Multiplication, Division, Addition, Subtraction, b. Multiplication, Division, Addition, Subtraction, Parentheses, Exponential ¢, Division, Multiplication, Addition, Subtraction, Parentheses, Exponential 4, Exponential, Parentheses, Multiplication, Division, Addition, Subtraction Answer: (a) Parentheses, Exponential, Multiplication, Division, Addition, Subtraction Explanation: PEMDAS (similar to BODMAS). Q. Which one of the following has the same precedence level? a Division, Power, Multiplication, Addition and Subtraction b. Division and Multiplication ¢, Subtraction and Division d. Power and Division Answer: (b) Division and Multiplication ‘Explanation: None Q. Which one of the following has the highest precedence in the expression? a Division b. Subtraction cc. Power Parentheses Answer: (d) Parentheses Explanation: PEMDAS (similar to BODMAS). . Which of the following functions is a built-in function in python language’? a. ‘val() b. print ce. print() d. None of these Answer: (b) print() Explanation: The print() function is a built-in function in python language that prints a value directly to the system. Q. Study the following funetion: round(4.576) What will be the output of this function? a 4 bos c. 576 ds Answer: (d) 5: The round function is a built-in function in the Python language that round-off the value (like 3.85 is 4), so the output of this function will be 5. Q Which of the following is correctly evaluated for this function? pow(x.y.z) a (xy) /z b. (&/y)#z eC) % dd @&/y/2 Answer: (c) (x**y) % 2 ‘Explanation; None Q. Study the following function: all((2,4,0,6)) ‘What will be the output of this function? a False b. Tre 0 d. Invalid code Answer: (a) False ‘Explanation: If any element is zero, it returns a false value, and if all elements are non-zero, it returns true value, Hence, the output of this “all({2,4,0,6])" function will be false. Q. Study the following program: x=1 while True: ifx%5 break rint(x) x+el ‘What will be the output of this code? a error b 21 e031 d. None of these Answer: (a) error Explanation: Syntax error, there should not be a space between + and =, Q. Which one of the following syntaxes is the correct syntax to read from a simple text file stored in javatxt’ Infile Infile Infile Infile Answer: (a) Infile = open(’c:\scores.tx ‘Explanation: NonewRYNe DURWIS BADD EUNE Q. Study the following program: isk while True: if i963 break print(i) Which of the following is the correct output of this program? a 123 b. 321 c. 12 Invalid syntax Answer: (d) Invalid syntax Explanation: Invalid syntax, because this declaration ( ) is wrong. Q. Study the following program: a=1 while True: ifa% 7= break print(a) ats Which of the following is correct output of this program? a. 12345 b. 123456 ec. 1234567 d. Invalid syntax Answer: (b) 123.456 Explanation: None Q. Study the following program: i=0 while i < 5: print(i) its! ifi break else: print(0) What will be the output of this statement? a 123 b. 0123 . O12 d 321 Answers (¢)0 12 Explanation: NoneStudy the following program: = (0,1,2) for ind: prima) ‘What will be the output ofthis statement? a 40.1.2) (0,1,2} (0, 1,2) b 012 ©. Syntx_Eor d._ None ofthese shove Answer: (b) 0112 Explanation: None Q, Which ofthe following option is not a core datatype in the python language? a Dictionary b. Lists ce. Class Alot the above Answer: (c) Class Explanation: Classis not a core datatype because it user-defined data type Q. What error will occur when you execute the following code? MANGO = APPLE a. NameErvor 1b. SyntaxExror ce. TypeEror 4d. ValueError Answer: (a) NamaEror Explanation: Mango is not defined hence the name ero . Study the following program: def example(a) aa=as'T aa=atl >>>examplo("javatpoint”) ‘What will be the output ofthis statement? a. hello2hello2 b. hello? ‘e. Cannot perform mathematical operation on strings
You might also like
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Mark Manson
Rating: 4 out of 5 stars
4/5 (6024)
Principles: Life and Work
From Everand
Principles: Life and Work
Ray Dalio
Rating: 4 out of 5 stars
4/5 (626)
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Brene Brown
Rating: 4 out of 5 stars
4/5 (1132)
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
Chris Voss
Rating: 4.5 out of 5 stars
4.5/5 (911)
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Jeannette Walls
Rating: 4.5 out of 5 stars
4.5/5 (1741)
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
Jesmyn Ward
Rating: 4 out of 5 stars
4/5 (1245)
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Angela Duckworth
Rating: 4 out of 5 stars
4/5 (628)
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
Margot Lee Shetterly
Rating: 4 out of 5 stars
4/5 (937)
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Stephen Chbosky
Rating: 4.5 out of 5 stars
4.5/5 (2121)
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Phil Knight
Rating: 4.5 out of 5 stars
4.5/5 (548)
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Ben Horowitz
Rating: 4.5 out of 5 stars
4.5/5 (358)
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
Ashlee Vance
Rating: 4.5 out of 5 stars
4.5/5 (481)
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Roxane Gay
Rating: 4 out of 5 stars
4/5 (1062)
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
Siddhartha Mukherjee
Rating: 4.5 out of 5 stars
4.5/5 (275)
Steve Jobs
From Everand
Steve Jobs
Walter Isaacson
Rating: 4.5 out of 5 stars
4.5/5 (821)
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Frank McCourt
Rating: 4.5 out of 5 stars
4.5/5 (444)
The Outsider: A Novel
From Everand
The Outsider: A Novel
Stephen King
Rating: 4 out of 5 stars
4/5 (1954)
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
Sarah M. Broom
Rating: 4 out of 5 stars
4/5 (99)
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Thomas L. Friedman
Rating: 3.5 out of 5 stars
3.5/5 (2281)
Yes Please
From Everand
Yes Please
Amy Poehler
Rating: 4 out of 5 stars
4/5 (1961)
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
Gilbert King
Rating: 4.5 out of 5 stars
4.5/5 (273)
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
Garth Stein
Rating: 4 out of 5 stars
4/5 (4264)
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
Betty Smith
Rating: 4.5 out of 5 stars
4.5/5 (1934)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Dave Eggers
Rating: 3.5 out of 5 stars
3.5/5 (233)
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Doris Kearns Goodwin
Rating: 4.5 out of 5 stars
4.5/5 (235)
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Bob Woodward
Rating: 3.5 out of 5 stars
3.5/5 (805)
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Naomi Klein
Rating: 4 out of 5 stars
4/5 (75)
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Jay Sekulow
Rating: 3.5 out of 5 stars
3.5/5 (140)
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
Jennifer Egan
Rating: 3.5 out of 5 stars
3.5/5 (883)
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
George Packer
Rating: 4 out of 5 stars
4/5 (45)
John Adams
From Everand
John Adams
David McCullough
Rating: 4.5 out of 5 stars
4.5/5 (2520)
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel
John le Carré
Rating: 3.5 out of 5 stars
3.5/5 (109)
MCQS of Cyber Ethics ...
Document
21 pages
MCQS of Cyber Ethics ...
siddheshverma0912
No ratings yet
Certificate 1
Document
1 page
Certificate 1
siddheshverma0912
No ratings yet
Cyber Ethics Notes
Document
15 pages
Cyber Ethics Notes
siddheshverma0912
100% (4)
Assertion and Reason
Document
5 pages
Assertion and Reason
siddheshverma0912
No ratings yet
Little Women
From Everand
Little Women
Louisa May Alcott
Rating: 4 out of 5 stars
4/5 (105)