B.Tech Students: Apply for Live Programming Internship C, C++, Java, Python ,Web page Designing, PHP C Variables Quiz | C Programming Test

C Programming Quiz: Variables

Q1. Which is the correct way to declare a variable in C?C में वैरिएबल घोषित करने का सही तरीका क्या है?

Correct: int a;

Variable declarations in C follow the format: type name; e.g., int a;

Q2. What is the default value of an uninitialized local variable in C?C में बिना इनिशियलाइज किए गए लोकल वैरिएबल की डिफ़ॉल्ट वैल्यू क्या होती है?

Correct: Garbage value

Local variables are not initialized automatically; they contain garbage values.

Q3. Which of the following is a valid variable name in C?निम्नलिखित में से कौन सा वैध वैरिएबल नाम है?

Correct: _var

Variable names can't start with a digit. '_var' is valid.

Q4. What does the keyword 'const' do in a variable declaration?'const' कीवर्ड वैरिएबल में क्या करता है?

Correct: Makes variable unchangeable

The 'const' keyword makes a variable read-only after initialization.

Q5. Which data type can store a single character?एक सिंगल कैरेक्टर को कौन सा डेटा टाइप स्टोर कर सकता है?

Correct: char

'char' is used to store a single character in C.

Q6. Which operator is used to assign a value to a variable?वैरिएबल को वैल्यू असाइन करने के लिए कौन सा ऑपरेटर इस्तेमाल होता है?

Correct: =

The '=' operator is used for assignment in C.

Q7. How many bytes does an 'int' typically occupy in C (on 32-bit)?32-बिट सिस्टम पर 'int' आमतौर पर कितने बाइट लेता है?

Correct: 4

On most 32-bit systems, an int occupies 4 bytes.

Q8. Which of these is a floating-point data type?इनमें से कौन सा फ्लोटिंग-पॉइंट डेटा टाइप है?

Correct: float

'float' is a floating-point type used for decimals.

Q9. What will happen if a variable is used without declaration?अगर किसी वैरिएबल का डिक्लरेशन किए बिना उपयोग किया जाए तो क्या होगा?

Correct: Error

In C, using undeclared variables causes a compilation error.

Q10. What is the keyword to declare a variable as global?वैरिएबल को ग्लोबल घोषित करने के लिए कौन सा कीवर्ड उपयोग होता है?

Correct: extern

'extern' can be used to reference global variables declared elsewhere.