Python Basics Quiz

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

An ordered set of instruction to be executed by a computer by a computer to carry out a specific task is called ______.

Program

Computer understand the language of 0s and 1s which is called

  • Algorithm
  • Pseudo code
  • Program
  • All of the above (correct)

A program written in a high-level language is called ______code.

Binary language

Language translator convert ______ code to ______ code.

<p>Source, Object (A)</p> Signup and view all the answers

Which of the following is not correct about python?

<p>Python is based an ABC language. (B)</p> Signup and view all the answers

Python is case sensitive.

<p>True (A)</p> Signup and view all the answers

Which keyboard key is used to run python programs?

<p>F5 (A)</p> Signup and view all the answers

All keywords in Python are in lower case.

<p>True (A)</p> Signup and view all the answers

Which of the following is not the feature of python language?

<p>All of the above (D)</p> Signup and view all the answers

In which of the following mode, the interpreter executes the statement and displays the result as soon as we press 'Enter' key?

<p>Interactive mode (A)</p> Signup and view all the answers

By default, the Python scripts are saved with ______ extension.

<p>.py</p> Signup and view all the answers

By default, the Python scripts are saved in ______.

<p>Python installation folder (C)</p> Signup and view all the answers

______ are reserved words.

<p>Keywords (C)</p> Signup and view all the answers

Which of the following is not correct for naming an identifier in Python?

<p>Spaces are allowed in identifiers (A)</p> Signup and view all the answers

Comments in python program are ______ by interpreter.

<p>not executed (A)</p> Signup and view all the answers

In Python single line comment starts with ______.

<h1></h1> Signup and view all the answers

In Python multi line comment starts with ______.

<p>'''</p> Signup and view all the answers

Which of the following is a sequence data type?

<p>String (A)</p> Signup and view all the answers

______ is a set of valid characters that a language can recognize.

<p>Token</p> Signup and view all the answers

The smallest individual unit in a program is known as ______

<p>Token (C)</p> Signup and view all the answers

Which of the following is invalid identifier?

<p>Literals (A)</p> Signup and view all the answers

Which of the following statement is wrong?

<p>break / FILE34 / F_L / Myname (A)</p> Signup and view all the answers

Identifier can start with number.

<p>None of the above (A)</p> Signup and view all the answers

Variables of data types like integers, float etc., hold ______

<p>single value (A)</p> Signup and view all the answers

An ______ is a symbol which is used to perform specific mathematical or logical operation on values.

<p>Operator</p> Signup and view all the answers

Operators work on values called ______.

<p>Operand (B)</p> Signup and view all the answers

Operators working on Operand ______ data value.

<p>data value (D)</p> Signup and view all the answers

Which of the following is number data type in python?

<p>All of the above (D)</p> Signup and view all the answers

Binary operators are operators with ______ operands.

<p>2 (B)</p> Signup and view all the answers

In Python, we have ______ function for taking input from the user.

<p>input() (C)</p> Signup and view all the answers

The user may enter a number or a string but the input() function treats them as ______.

<p>strings only (B)</p> Signup and view all the answers

Flashcards

Python Program

An ordered set of instructions for a computer to perform a specific task.

Binary Language

A language computers understand, using only 0s and 1s.

Machine Language

A low-level computer language.

Source Code

A program written in a high-level language, like Python.

Signup and view all the flashcards

Interpreter

A program that translates Python code into machine code.

Signup and view all the flashcards

Compiler

An alternative way to translate high-level code to machine code.

Signup and view all the flashcards

Language Translators

Programs that convert source code into machine code.

Signup and view all the flashcards

Python's Case Sensitivity

Python treats uppercase and lowercase letters differently in identifiers and keywords.

Signup and view all the flashcards

Python Keywords

Reserved words with special meanings in Python, all in lowercase.

Signup and view all the flashcards

Python Script Extension

The file ending for Python programs (e.g., '.py').

Signup and view all the flashcards

Identifiers

Names given to variables, functions, etc. in Python.

Signup and view all the flashcards

Comments

Explanations within a program, not executed by the interpreter.

Signup and view all the flashcards

Single-Line Comment

A comment in Python that starts with '#' and lasts till end of line.

Signup and view all the flashcards

Multiline Comment

A comment spanning multiple lines, delimited by triple quotes (""").

Signup and view all the flashcards

Sequence Data Types

Data types in Python that hold collections of items.

Signup and view all the flashcards

Integer

A whole number data type in a computer.

Signup and view all the flashcards

Float

A number with a decimal point.

Signup and view all the flashcards

Invalid Identifier Example

Names that Python cannot use as labels for program parts.

Signup and view all the flashcards

Token

The smallest units of a programming language.

Signup and view all the flashcards

Literal

In Python, it represents fixed values in programs, like numbers and strings.

Signup and view all the flashcards

Variable Type

Categories of data that variables can hold in a program.

Signup and view all the flashcards

Binary Operators

Operators that work with two operands.

Signup and view all the flashcards

User Input

Data entered by a user into a running program.

Signup and view all the flashcards

Numerical User Input

User input expected to be in a numeric format.

Signup and view all the flashcards

Boolean

Logical data type that can hold 'True' or 'False' values.

Signup and view all the flashcards

Study Notes

Python Basics

  • Python is an ordered set of instructions executed by a computer to perform a task.
  • Python uses a high-level language, which is converted to machine code.
  • Python uses an interpreter to convert code.
  • Python is an open-source language developed by Guido van Rossum.
  • Python is case-sensitive.
  • Python's keywords are written in lowercase.
  • Python programs are run using the Ctrl + R key combination.

Data Types and Variables

  • Variables can store different types of data.
  • Integers, floats, and strings are examples of data types.
  • Variables can hold a single value.
  • Variables start with a letter or underscore.

Operators

  • Operators perform actions on data values.
  • Operators can be mathematical, logical, or comparison.

Comments

  • Comments are notes in the code that do not affect the program's execution.
  • Single-line comments start with #.
  • Multi-line comments use triple quotes ("""...""").

Identifiers

  • Identifiers are used to name variables, functions, classes.
  • Identifiers cannot start with numbers.
  • Reserved words (keywords) cannot be identifiers.

Data Types

  • Integer, float, string, boolean, and complex are data types.

Input/Output functions

- input()
  • The input() function receives input from the user.
  • The user input can be treated either as a string or a number depending on the program.

Python Statements

  • Python uses brackets (()), braces ({}), and parentheses ([]).
  • Python executes statements sequentially.

Interactive mode

  • Interactive mode is when Python executes statements as soon as they're entered.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

More Like This

Python Programming Basics
10 questions
Python Programming Basics Quiz
5 questions

Python Programming Basics Quiz

LowRiskHeliotrope8202 avatar
LowRiskHeliotrope8202
Python Programming Basics
10 questions
Python Programming Basics
5 questions

Python Programming Basics

PopularCalifornium avatar
PopularCalifornium
Use Quizgecko on...
Browser
Browser