PROGRAMMING LANGUAGE - LESSON 6

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/9

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 11:15 AM on 5/31/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

10 Terms

1
New cards

WHAT IS SYNTAX?

  • In programming languages, syntax defines the rules that determine the structure and arrangement of keywords, symbols, and other elements. Syntax is concerned with the grammar and structure of the programming language and is unrelated to the meaning of the statements.

  • A line of code is syntactically valid and correct if it adheres to all the syntax rules. Syntax does not pertain to the meaning of the statement. Syntax errors are identified after the program is executed.

  • Examples of syntax errors include missing semicolons in C++ and undeclared variables in Java, which are typically easy to detect.

2
New cards

WHAT IS SEMANTICS?

  • Semantics refers to the meaning of the associated line of code and how they are executed in a programming language. Hence, semantics helps interpret what function the line of code/program is performing.

  • Semantic errors are encountered and handled during runtime of the program execution. If there is any semantic error and even when the statement has corrected syntax, it wouldn't perform the function that was intended for it to do. Thus, such errors are difficult to catch.

3
New cards

DIFFERENCES OF SYNTAX AND SEMANTICS?

  • Syntax defines the rules and regulations that help write any statement in a programming language,

  • while semantics refers to the meaning of the associated line of code in the programming language.

4
New cards

THE FOLLOWING TABLE HIGHLIGHTS ALL THE

SIGNIFICANT DIFFERENCES BETWEEN SYNTAX

AND SEMANTICS −

SYNTAX

  • Syntax is one that defines the rules and

    regulations that helps to write any

    statement in a programming language.

  • Syntax does not have any relationship

    with the meaning of the statement.

  • Syntax errors are encountered after the

    program has been executed

  • Syntax errors are easy to catch.

SEMANTICS

  • Semantics is one that refers to the

    meaning or logical effect of code in a

    programming language.

  • Semantics tells about the meaning.

  • They are encountered at runtime.

  • Semantics errors are difficult to catch.

5
New cards

Comments

Single-line comment: // This is a single-line comment.

Multi-line comment: /* … */ This is multi-line comment.

6
New cards

Data types

  • Primitive Data Types: (ex. Integers, Floating point, Character, Booleans)

  • Non-Primitive Data Types: (ex. String, Array, Classes & Object, Interfaces)

7
New cards

Variables

Declaring and Initializing:

8
New cards

Operators

Arithmetic Operators:

Comparison Operators:

Logical Operators:

9
New cards

Control Structures

If-Else:

Switch-case:

For Loop, while Loop, Do-while Loop:

10
New cards

Classes and Object

Defining a Class:

Creating Objects: