Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

Python Slip Test

Python is an interpreted, object-oriented, high-level programming language widely used in web development and machine learning. Key features include easy syntax, dynamic typing, and support for multiple programming paradigms. The document also outlines Python's principles, keywords, and provides example programs for checking Armstrong numbers and reversing a number.

Uploaded by

Ruchita Maaran
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Python Slip Test

Python is an interpreted, object-oriented, high-level programming language widely used in web development and machine learning. Key features include easy syntax, dynamic typing, and support for multiple programming paradigms. The document also outlines Python's principles, keywords, and provides example programs for checking Armstrong numbers and reversing a number.

Uploaded by

Ruchita Maaran
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

1. What is Python Programming Language?

Ans: Python is an interpreted, object-oriented, high-level programming


language with dynamic semantics.
Python is a high-level, general-purpose, and very popular programming
language.
Python programming language (latest Python 3) is being used in web
development, and Machine Learning applications, along with all cutting-edge
technology in Software Industry.
There are two major Python versions: Python 2 and Python 3.
2. What can Python do?
Ans:
 Python can be used on a server to create web applications.
 Python can be used alongside software to create workflows.
 Python can connect to database systems. It can also read and modify
files.
 Python can be used to handle big data and perform complex
mathematics.
 Python can be used for rapid prototyping, or for production-ready
software development.
3. What is the main concept of Python?
Ans: Python has a simple syntax similar to the English language.
Python has syntax that allows developers to write programs with fewer lines
than some other programming languages.
Python runs on an interpreter system, meaning that code can be executed as
soon as it is written.
This means that prototyping can be very quick.
4. What are the 5 features of Python?
Ans: Python is easy to learn and use, object-oriented, interpreted, cross-
platform, has an extensive standard library, is dynamically typed, supports
multiple programming paradigms, is free and open source, and supports
databases and GUI programming.
5. What are the 4 pillars of Python?
Ans: The 4 pillars of object-oriented programming (OOP) in Python (and
generally in programming) are:
Encapsulation: Bundling data (attributes) and methods (functions) that
operate on the data into a single unit (class).
Abstraction: Hiding complex implementation details and providing a simplified
interface.
Inheritance: Allowing a class to inherit attributes and methods from another
class, promoting code reuse.
Polymorphism: Using a single interface to represent different data types or
objects.
6. What are the 5 Python principles?
 Single-responsibility principle (SRP)
 Open–closed principle (OCP)
 Liskov substitution principle (LSP)
 Interface segregation principle (ISP)
 Dependency inversion principle (DIP)

7. Write any 10 keywords in Python?


Ans: if, else, for, while, def, class, import, return, True, and False.
8. What are Python features?
9. Write a Python Program to check Armstrong Number.
num = int(input("Enter a number: "))
order = len(str(num))
sum = 0
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** order
temp //= 10
if num == sum:
print(num,"is an Armstrong number")
else:
print(num,"is not an Armstrong number")
10. Write a Python Program to Reverse a Number.
num = int(input("Enter a number: "))
reversed_num = 0
while num != 0:
digit = num % 10
reversed_num = reversed_num * 10 + digit
num //= 10
print("Reversed Number: " + str(reversed_num))

You might also like