0% found this document useful (0 votes)
23 views

Assignment 2

Uploaded by

Khawla Alameri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Assignment 2

Uploaded by

Khawla Alameri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Higher Colleges of Technology Assignment 2

Faculty of Electronic Engineering

EGN 2712: Applied Programming

Identifiers
Student Name: Score from 1
Student ID #:

Q1. Determine which of the following are valid identifiers. If invalid, explain why.

Identifiers Valid / Invalid Give Reasons if INVALID


(a) record1 Valid
(b) 1record Invalid Identifiers must start with a letters or
underscore.
(c) file_3 Valid
(d) return Invalid The word has a specific meaning in the
program. ‘return is a reserved word’
(e) $tax Invalid Identifiers must start with a letters or
underscore.
(f) name Valid
(g) name and address Invalid There is a space between the words.
‘blank spaces are not allowed’
(h) name_and_address Valid
(i) name-and-address Invalid cannot use dash “-“
(j) 123-45-6789 Invalid Identifiers must start with a letters or
underscore.
Q2. Write appropriate declarations for each group of variables and arrays.

Declarations
1. Floating-point variables: x, y, z float x, y, z;

2. Integer variables: p, q int p, q;

3. Character variables: a, b, c char a, b, c;

4. Floating-point variables: root1, root2 float root1, root2;

5. Long integer variable: counter long counter;

6. Short integer variable: flag short flag;

You might also like