דילוג לתוכן
מבחן 10 שאלות

Variables and Data Types

שאלות 10

מפתח התשובות מוצג למורים מחוברים.

  1. רב־ברירהשפות תכנותvariablesprogramming basicsstorage location

    Meaning of a variable

    In programming, what is a variable best described as?

    1. A type of loop that repeats code a set number of times

    2. A fixed value that can never be changed during execution

    3. A named storage location that holds a value which can change

    4. A comment that explains what the program does


    Think about the word 'variable' itself: what does it suggest about the value it holds?
  2. רב־ברירהשפות תכנותvariablesassignment operatorprogramming basics

    Assignment operator

    In most programming languages such as Python, JavaScript and Java, which symbol is used to assign a value to a variable?

    1. =

    2. <>

    3. :=>

    4. ==


    This single equals sign is the simplest symbol used for storing a value into a variable.
  3. רב־ברירהשפות תכנותdata typesIntegers

    Integer data type

    Which data type is most suitable for storing the number of students in a class, such as 28?

    1. Float

    2. String

    3. Boolean

    4. Integer


    The number of students is a whole number with no decimal part.
  4. רב־ברירהשפות תכנותdata typesboolean values

    Boolean data type

    Which data type can only hold one of two values, true or false?

    1. Float

    2. Boolean

    3. Character

    4. Array


    The name of this data type comes from a mathematician who studied logic with two possible states.
  5. רב־ברירהשפות תכנותvariablesassignmentאריתמטיקה

    Value after reassignment

    What is the value of x after the following code runs?

    x = 5
    x = x + 3

    1. 5

    2. 3

    3. 8

    4. 53


    The second line takes the current value of x, adds 3 to it, and stores the result back in x.
  6. רב־ברירהשפות תכנותdata typesstringstext

    Data type of text

    Which data type is used to store a sequence of characters such as a person's name?

    1. Float

    2. String

    3. Integer

    4. Boolean


    A name is made of letters, which are grouped together as a sequence of characters.
  7. רב־ברירהשפות תכנותdata typesfloating-pointnumber types

    Floating-point numbers

    Which data type is used to store a number with a decimal part, such as 3.75?

    1. Boolean

    2. String

    3. Float

    4. Integer


    Numbers that include a decimal point need a data type that can represent fractional parts.
  8. רב־ברירהשפות תכנותstatic typingtype mismatchcompilation errors

    Static typing

    In a statically typed language such as Java, what happens when you declare a variable as an int and then try to store the text "hello" in it?

    1. The program does not compile because the types do not match

    2. The text is automatically converted to a number

    3. The program runs and stores 0 instead

    4. The variable silently changes its type to String


    In statically typed languages, the type is checked before the program runs, and a mismatch is reported as an error.
  9. רב־ברירהשפות תכנותconst keywordvariable declarationjavascript

    Constants

    Which keyword in JavaScript is used to declare a variable whose value cannot be reassigned after it is set?

    1. const

    2. let

    3. static

    4. var


    The name of this keyword suggests a value that stays the same, like a fixed number such as pi.
  10. רב־ברירהשפות תכנותvariablesdynamic typingtype reassignment

    Dynamic typing

    In Python, the following code runs without error:

    value = 10
    value = "ten"

    What best describes this behaviour?

    1. Python converts the number 10 into a text character

    2. Python is statically typed and this is an error

    3. The second line deletes the first line

    4. A variable can hold a value of a different type after reassignment because the type is tied to the value


    Consider what dynamically typed languages allow regarding the type of a variable's value over time.

פרטים

Questions on what a variable is, common data types such as integers, strings and booleans, and how values are assigned and changed in a program. Suitable for an introductory programming unit.
מקצועות
שפות תכנות
קהל יעד
חטיבת ביניים · כיתות ח׳–ט׳
רמת קושי
4 מתוך 10
שפה
אנגלית
מי יכול לראות
כולם
הושלם על ידי AI
מה שמסומן בניצוץ נוסף על ידי AI.
נוצר באמצעות AI
Claude Haiku 5.5
נוצר

תגובות

  1. אין תגובות עדיין.
© כל הזכויות שמורות