CS_Lexical_Structure_quiz.md - brainchildservices/curriculum GitHub Wiki
-
What is lexical structure of programming language?
- The lexical structure of a programming language is the set of basic rules that governs how you write programs in that language.
-
What is a token?
- A lexical token is a sequence of characters that can be treated as a unit in the grammar of the programming languages.
-
Give some examples for non-tokens
- preprocessor directive, macros, blanks, tabs, newline ,etc.
-
How many tokens are in this printf method: printf("BrainChild");
- 5
-
What is the use of comments?
- Comments provide clarity to the C source code allowing others to better understand what the code was intended to accomplish and greatly helping in debugging the code.
-
For what normally white spaces are used in c#?
- White space in C# is used to separate tokens in the source file.
7.Why is too much white space bad?
- Too much whitespace can make a page look lazy and bland.
8.What is a variable?
- A variable is an identifier which holds a value.
9.What is literals? Point out two literals.
- A literal is a textual representation of a particular value of a type. 1.boolean literals 2.Integer literals
10.What is Operators?
- An operator is a symbol used to perform an action on some value. Operators are used in expressions to describe operations involving one or more operands. 11.What is separators?
- A separator is a sequence of one or more characters used to specify the boundary between separate, independent regions in plain text or other data stream.
- Point out the Use of Brackets.
- 1.Parentheses (round brackets) are used to mark the method signature. The signature consists of method parameters. 2.Curly brackets are used to denote the evaluated value. Curly brackets {} are also used to initiate arrays. Curly brackets are also used in variable interpolation or to enclose the body of a method or a class. 3.Square brackets [] are used to denote an array type. They are also used to access or modify array elements.
13.What is a keyword in c#?
- A keyword is a reserved word in the C# language. Keywords are used to perform a specific task in the computer program.
14.Point out some reserved words.
- public, static, void, int , for ,while, base, false, float, catch, this, and many others.