FliQi Education App Download
प्रश्न-बैंक · C Language

Tokens in C Language — प्रश्न और उत्तर

C Language · 83 जाँचे हुए (verified) प्रश्न

  • 83 जाँचे हुए प्रश्न
  • हिंदी + English

पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 20 के उत्तर और हल FliQi Question Bank app में।

भाषा
प्रश्न 1उत्तर + हल
निम्नलिखित में से कौन-से C में टोकन हैं?
Which of the following are tokens in C?
  1. Aआइडेंटिफायर (Identifiers)Identifiers
  2. Bकॉन्स्टेंट (Constants)Constants
  3. Cकीवर्ड (Keywords)Keywords
  4. Dउपरोक्त सभीAll of the mentioned

सही उत्तर / Answer: (D)

हल / Solution
C के टोकन छह वर्गों में आते हैं: keyword, identifier, constant, string, operator और special symbol। जैसे float rate = 7.5; में float एक keyword है, rate एक identifier है, 7.5 एक constant है, = एक operator है और ; एक special symbol है। identifier, constant और keyword तीनों ही टोकन के वर्ग हैं। इसलिए A, B या C अकेले अधूरे हैं और सही उत्तर D है।
C tokens fall into six classes: keywords, identifiers, constants, string literals, operators and special symbols. In the statement float rate = 7.5; float is a keyword, rate is an identifier, 7.5 is a constant, = is an operator and ; is a special symbol. Since identifiers, constants and keywords are each a class of token, none of A, B or C alone is complete, and the answer is D.
प्रश्न 2उत्तर + हल
इनमें से कौन-सा lexeme का एक प्रकार है?
Which one is a type of lexeme?
  1. Aआइडेंटिफायर (Identifiers)Identifiers
  2. Bकॉन्स्टेंट (Constants)Constants
  3. Cकीवर्ड (Keywords)Keywords
  4. Dउपरोक्त सभीAll of the mentioned

सही उत्तर / Answer: (D)

हल / Solution
lexeme source code में characters का वह समूह है जो किसी token के pattern से मेल खाता है। lexical analyzer इन lexeme को अलग-अलग वर्गों में बाँटता है। जैसे int x = 10; में int एक keyword है, x एक identifier है और 10 एक constant है। = और ; क्रमशः operator और punctuator हैं। इसलिए identifier, constant और keyword तीनों lexeme के प्रकार हैं, और सही उत्तर D है।
A lexeme is a group of characters in the source code that matches the pattern of some token. The lexical analyzer sorts lexemes into classes. In int x = 10; the lexeme int is a keyword, x is an identifier and 10 is a constant, while = and ; are an operator and a punctuator. So identifiers, constants and keywords are all kinds of lexemes, and option D is correct.
प्रश्न 3उत्तर + हल
लेक्सिकल विश्लेषण किसमें विभिन्न लेक्सिकल इकाइयों की पहचान करता है?
Lexical analysis identifies different lexical units in a:
  1. Aसोर्स कोड (Source code)Source code
  2. Bऑब्जेक्ट कोड (Object code)Object code
  3. Cलेक्सीम (Lexeme)Lexeme
  4. Dइनमें से कोई नहींNone of the mentioned

सही उत्तर / Answer: (A)

हल / Solution
lexical analysis source code को पढ़कर उसे lexical इकाइयों में बाँटता है, जैसे keyword, identifier, constant, operator और चिह्न। जैसे source की पंक्ति sum = a + 5; में यह sum, =, a, +, 5 और ; इकाइयाँ पहचानता है। यही इकाइयाँ lexeme हैं। इसलिए lexeme इसका नतीजा है, वह जगह नहीं जहाँ इकाइयाँ खोजी जाती हैं। object code बहुत बाद में, code generation के बाद बनता है।
Lexical analysis scans the source code and breaks it into lexical units such as keywords, identifiers, constants, operators and punctuation. For example, in the source line sum = a + 5; it finds the units sum, =, a, +, 5 and ;. These units are the lexemes it produces, so a lexeme is the result, not the place where units are found. Object code comes much later, after code generation.
प्रश्न 4उत्तर + हल
लेक्सिकल एनालाइज़र का इनपुट क्या है?
The input to the lexical analyser is:
  1. Aसोर्स कोड (Source code)Source code
  2. Bऑब्जेक्ट कोड (Object code)Object code
  3. Cलेक्सीम (Lexeme)Lexeme
  4. Dइनमें से कोई नहींNone of the mentioned

सही उत्तर / Answer: (A)

हल / Solution
lexical analyzer compiler का पहला चरण है। इसलिए इसे programmer का लिखा source program ही characters की धारा के रूप में मिलता है। यह source code पढ़ता है, characters को lexeme में जोड़ता है और token syntax analyzer को देता है। यानी lexeme इसका output है, input नहीं। object code तो compilation के आख़िर में बनता है, इसलिए वह पहले चरण का input नहीं हो सकता।
The lexical analyzer is the first phase of the compiler, so it receives the source program written by the programmer as a stream of characters. It reads this source code, groups characters into lexemes and gives tokens to the syntax analyzer. Lexemes are its output, not its input. Object code is produced only at the end of compilation, so it cannot be the input of the first phase.
प्रश्न 5उत्तर + हल
लेक्सिकल एनालाइज़र कंपाइलर का कौन-सा चरण है?
Which phase of the compiler is the lexical analyser?
  1. AपहलाFirst
  2. BदूसराSecond
  3. CतीसराThird
  4. Dइनमें से कोई नहींNone of the mentioned

सही उत्तर / Answer: (A)

हल / Solution
compiler के छह चरण होते हैं। पहला lexical analysis, दूसरा syntax analysis, तीसरा semantic analysis, चौथा intermediate code generation, पाँचवाँ code optimization और छठा code generation। lexical analysis सबसे पहले आता है, क्योंकि बाक़ी सभी चरणों को token चाहिए, और characters से token सिर्फ़ यही बनाता है। दूसरा और तीसरा चरण syntax और semantic analysis के हैं। इसलिए B, C और D ग़लत हैं।
A compiler usually works in six phases: lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization and code generation. Lexical analysis comes first because every later phase needs tokens, and only the lexical analyzer turns raw characters into tokens. Syntax analysis is the second phase and semantic analysis is the third, so options B and C describe other phases and D is wrong.
प्रश्न 6उत्तर + हल
एक अकेले (individual) टोकन को क्या कहा जाता है?
An individual token is called:
  1. Aलेक्सीम (Lexeme)Lexeme
  2. Bलेक्स (Lex)Lex
  3. CLexeme और Lex दोनोंLexeme & Lex
  4. Dइनमें से कोई नहींNone of the mentioned

सही उत्तर / Answer: (A)

हल / Solution
lexeme source code में लिखे characters का वह असली क्रम है जो एक token बनाता है। जैसे count = count + 1; में lexeme हैं: count, =, count, +, 1 और ;। हर lexeme को identifier या operator जैसे token के रूप में आगे भेजा जाता है। इसलिए प्रोग्राम में लिखे एक अकेले token को lexeme कहते हैं। Lex एक tool है जो lexical analyzer बनाता है; यह token का नाम नहीं है।
A lexeme is the actual sequence of characters in the source code that forms one token. In count = count + 1; the lexemes are count, =, count, +, 1 and ;, and each is reported as a token such as identifier or operator. So an individual token, as written in the program, is called a lexeme. Lex is a tool that generates lexical analyzers from patterns; it is not a name for a token.
प्रश्न 7उत्तर + हल
कंपाइलर में वह मॉड्यूल जो source text के हर character को जाँचता है, कहलाता है:
In a compiler, the module that checks every character of the source text is called:
  1. Aकोड जनरेटर (code generator)The code generator
  2. Bकोड ऑप्टिमाइज़र (code optimizer)The code optimizer
  3. Cलेक्सिकल एनालाइज़र (lexical analyzer)The lexical analyzer
  4. Dसिंटैक्स एनालाइज़र (syntax analyzer)The syntax analyzer

सही उत्तर / Answer: (C)

हल / Solution
lexical analyzer, जिसे scanner भी कहते हैं, compiler का पहला चरण है। यही अकेला चरण है जो source program को एक-एक character करके पढ़ता है। यह characters को lexeme में जोड़ता है और आगे token भेजता है। space और comment भी यही हटाता है। syntax analyzer character नहीं, token पर काम करता है और grammar जाँचता है। optimizer intermediate code को बेहतर बनाता है और code generator machine code बनाता है।
The lexical analyzer, also called the scanner, is the first phase of a compiler. It is the only phase that reads the source program character by character, groups the characters into lexemes and passes tokens to the next phase. It also skips spaces and comments. The syntax analyzer works on tokens, not characters, to check grammar. The optimizer improves intermediate code, and the code generator produces target machine code.
प्रश्न 8उत्तर + हल
निम्नलिखित में से कौन-सा C भाषा में अमान्य variable नाम है?
Which one of the following is an invalid variable name in C language?
  1. ASt.Name
  2. BSt_Name
  3. CSt12Name
  4. DStName

सही उत्तर / Answer: (A)

हल / Solution
C में variable का नाम एक identifier है। इसमें सिर्फ़ अक्षर, अंक और underscore (_) आ सकते हैं, और यह अंक से शुरू नहीं हो सकता। dot (.) की अनुमति नहीं है, क्योंकि C में यह structure member तक पहुँचने का operator है। compiler St.Name को St, फिर . और फिर Name पढ़ता है। St_Name में underscore है, St12Name में अंक letter के बाद हैं और StName में सिर्फ़ अक्षर हैं। ये तीनों मान्य हैं।
A variable name in C is an identifier, so it may use only letters, digits and the underscore, and it must not begin with a digit. The dot is not allowed, because in C it is the member access operator; the compiler reads St.Name as St, then the operator ., then Name. St_Name uses a legal underscore, St12Name has digits after a letter, and StName uses only letters, so these three are valid.
प्रश्न 9उत्तर + हल
निम्नलिखित में से कौन-सा एक मान्य identifier नहीं है?
Which one of the following is not a valid identifier?
  1. A_algbly
  2. B1 algbly
  3. Calg_bly
  4. Dalgbly1

सही उत्तर / Answer: (B)

हल / Solution
C के identifier में सिर्फ़ अक्षर, अंक और underscore (_) आ सकते हैं। पहला अक्षर letter या underscore होना चाहिए। इसमें space नहीं हो सकता और कोई keyword भी identifier नहीं बन सकता। "_algbly" underscore से शुरू होता है, "alg_bly" में underscore बीच में है और "algbly1" में अंक आख़िर में है। तीनों मान्य हैं। "1 algbly" अंक से शुरू होता है और इसमें space भी है, इसलिए यह अमान्य है।
A C identifier may contain only letters, digits and the underscore, and its first character must be a letter or an underscore. It cannot contain a space and cannot be a keyword. "_algbly" starts with an underscore, "alg_bly" uses an underscore in the middle, and "algbly1" has the digit at the end, so all three are valid. "1 algbly" starts with a digit and also has a space, so it is invalid.
प्रश्न 10उत्तर + हल
identifier (पहचानकर्ता) क्या है?
What is an identifier?
  1. Afunction या variable का नामName of a function or variable
  2. Bmacro का नामName of a macro
  3. Cstructure या union का नामName of a structure or union
  4. Dउपरोक्त सभीAll of the above

सही उत्तर / Answer: (D)

हल / Solution
identifier वह नाम है जो programmer प्रोग्राम के किसी हिस्से को देता है। C में variable, function और macro के नाम identifier होते हैं। structure, union, enum constant और label के नाम भी identifier ही हैं। जैसे int total; में total एक identifier है, और #define MAX 100 में macro का नाम MAX भी identifier है। विकल्प A, B और C तीनों ऐसे ही नाम बताते हैं। इसलिए सही उत्तर D, यानी उपरोक्त सभी है।
An identifier is a name that the programmer gives to an element of the program. In C, variables, functions, macros, structure tags, union tags, enum constants and labels are all named with identifiers. For example, in int total; the name total is an identifier, and in #define MAX 100 the macro name MAX is also one. Since options A, B and C are all names of this kind, the answer is D.
आगे के 20 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
App खोलिए
प्रश्न 12उत्तर app में
Keywords को और किस नाम से जाना जाता है?
Keywords are also called:
  1. Aप्रीप्रोसेसर (Preprocessors)Preprocessors
  2. Bआरक्षित शब्द (Reserved words)Reserved words
  3. Cविराम चिह्न (Punctuation marks)Punctuation marks
  4. Dऑपरेटर (Operators)Operators
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 13उत्तर app में
प्रोग्राम जिन अलग-अलग syntactic तत्वों से मिलकर बनता है, उन्हें क्या कहते हैं?
A program is made up of individual syntactic elements called ______.
  1. Aक्लास (Classes)Classes
  2. Bफ़ंक्शन (Functions)Functions
  3. Cटोकन (Tokens)Tokens
  4. Dइनमें से कोई नहींNone of them
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 14उत्तर app में
C टोकन क्या है?
What is a C token?
  1. AC प्रोग्राम की सबसे छोटी अलग इकाईThe smallest individual unit of a C program
  2. Bcompiler द्वारा पहचाने जाने वाले मूल तत्वThe basic element recognized by the compiler
  3. Cप्रोग्राम की सबसे बड़ी अलग इकाईThe largest individual unit of the program
  4. DA और B दोनोंBoth A and B
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 16उत्तर app में
स्ट्रिंग कॉन्स्टेंट (string constant) को ______ के बीच लिखा जाता है।
String constants should be enclosed between ______.
  1. Aसिंगल कोट्स (Single quotes)Single quotes
  2. Bडबल कोट्स (Double quotes)Double quotes
  3. Ca और b दोनोंBoth a and b
  4. Dइनमें से कोई नहींNone of these
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 17उत्तर app में
कैरेक्टर कॉन्स्टेंट (character constant) को ______ के बीच लिखा जाता है।
Character constants should be enclosed between ______.
  1. Aसिंगल कोट्स (Single quotes)Single quotes
  2. Bडबल कोट्स (Double quotes)Double quotes
  3. Ca और b दोनोंBoth a and b
  4. Dइनमें से कोई नहींNone of these
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
Tokens in C Language के सभी 83 प्रश्न — उत्तर, हल और अभ्यास

FliQi Question Bank app में topic-वार अभ्यास, कठिनाई-स्तर और आपकी प्रगति।

  • पहला test मुफ़्त
  • हिंदी + English
  • जाँचे हुए उत्तर और हल

यह topic किन परीक्षाओं में आता है

C Language के दूसरे topics

सभी topics