Python Django – Multiple Choice Questions (MCQ) with Answers

python mcq with answers Tech Hyme

Python is a general-purpose, object-oriented, and open source computer programming language which is commonly used for both standalone programs and scripting applications in a wide variety of domains, by hundreds of thousands of developers.

On the other hand, Django is a Python-based free and open-source web framework that follows the model-template-views architectural pattern. It is maintained by the Django Software Foundation.

Suggested Read: Windows Server 2016 – Multiple Choice Questions (MCQ) With Answers

Basically Python is designed to optimize developer productivity, software quality, program portability, and component integration. Python programs run on most platforms in common use, including mainframes and supercomputers, Unix and Linux, Windows and Macintosh, Palm OS and WinCE, Java and .NET, and more.

Features of Python –

  • Simple – Python is a simple and minimalistic language. Reading a good Python program feels almost like reading English, although very strict English!
  • Easy to Learn – As you will see, Python is extremely easy to get started with. Python has an extraordinarily simple syntax.
  • Free and Open Source – Python is an example of a FLOSS (Free/Libré and Open Source Software). In simple terms, you can freely distribute copies of this software, read it’s source code, make changes to it, use pieces of it in new free programs, and that you know you can do these things.
  • High-level Language – When you write programs in Python, you never need to bother about the low-level details such as managing the memory used by your program,etc.
  • Portable – Due to its open-source nature, Python has been ported to many platforms. All your Python programs can work on any of these platforms without requiring any changes at all if you are careful enough to avoid any system-dependent features. You can use Python on Linux, Windows, FreeBSD, Macintosh, Solaris,
    etc.
  • Interpreted – A program written in a compiled language like C or C++ is converted from the source language i.e. C or C++ into a language that is spoken by your computer (binary code i.e. 0s and 1s) using a compiler with
    various flags and options. When you run the program, the linker/loader software copies the program from hard disk to memory and starts running it.
  • Object Oriented – Python supports procedure-oriented programming as well as object oriented programming. In procedure-oriented languages, the program is built around procedures or functions which are nothing but reusable pieces of programs.
  • Extensible – If you need a critical piece of code to run very fast or want to have some piece of algorithm not to be open, you can code that part of your program in C or C++ and then use them from your Python program.
  • Embeddable – You can embed Python within your C/C++ programs to give ‘scripting’ capabilities for your program’s users.
  • Extensive Libraries – The Python Standard Library is huge indeed. It can help you do various things involving regular expressions, documentation generation, unit testing, threading, databases, web browsers, CGI, ftp, email, XML, XML-RPC, HTML, WAV files, cryptography, GUI, Tk, and other system-dependent stuff.

Below is a list of few practice MCQ with Answers based on Python and Django Framework:

1. Python is a :

  • Development environment
  • Set of editing tools
  • Programming Language

2. Python is Case Sensitive when dealing with Identifiers?

  • Yes
  • No
  • Sometimes Only
  • None Of the Above

3. Which One is a Invalid Variable?

  • my_first_string
  • 1st_string
  • foo

4. What does the code output: 1+2+3

  • 3
  • 6
  • 9
  • 0

5. To perform exponential (power) calculation on operands which operator is use?

  • *
  • **
  • %

6. What is the answer of 23%3?

  • 1
  • 2
  • 3
  • 7

7. What is the OUTPUT of the expression: 3*1**3?

  • 27
  • 9
  • 3
  • 1

8. How you assign a variable in Python?

  • int x=2
  • x=2
  • var x=2

9. It is not possible to reassign a value in a variable?

  • true
  • false

10. Which is the datatype of the value assigned to the variable test ?
test=1234.56

  • int
  • float
  • string

11. What is the datatype of the following variable?
variable=123456

  • int
  • string
  • float

12. what is the datatype of the following variable?
variable=”12345″

  • int
  • string
  • float

13. what will be the value of a? a=5,6

  • 5
  • 6
  • (5
    6)

14. what is the type of b?
a=”udemy”
b=a[0]

  • srt
  • char
  • int

15. a={1,2,3,4,5} what is the type of a?

  • list
  • dict
  • tuples

16. what is the type of a?
a={1,2:3}

  • list
  • set
  • dict
  • syntax error

17. What is the OUTPUT when the following Statement is executed?
“abc”+”xyz”

  • abc
  • abcxyz
  • abcz
  • abcxy

18. What is the OUTPUT of the following Statement?
print 0xA + 0xB + 0xC :

  • 0xA0xB0xC
  • 33
  • ABC
  • 000XXXABC

Leave a Reply