B.Tech Students: Apply for Live Programming Internship C, C++, Java, Python ,Web page Designing, PHP Mostly Asked C Programming Questions - Basics | LiveCodeProgramming

Mostly Asked C Programming Questions – Basics (Top 10)

1. What are the main features of C language?1. C भाषा की मुख्य विशेषताएं क्या हैं?

- Procedural programming language
- Fast and efficient
- Middle-level language
- Supports pointers and structured programming
- Portable and widely used for system/software development
- प्रक्रियात्मक प्रोग्रामिंग भाषा
- तेज़ और कुशल
- मध्य-स्तरीय भाषा
- पॉइंटर्स और संरचित प्रोग्रामिंग का समर्थन करता है
- पोर्टेबल और सिस्टम/सॉफ्टवेयर विकास के लिए व्यापक रूप से उपयोग किया जाता है

2. Explain the structure of a C program.2. C प्रोग्राम की संरचना समझाएं।

A typical C program contains:
- Header files inclusion
- The main() function
- Variable declarations
- Logic and statements
- Return statement
Example:

#include <stdio.h>

int main() {
    // code here
    return 0;
}
        
एक सामान्य C प्रोग्राम में होता है:
- हेडर फाइल्स शामिल करना
- main() फ़ंक्शन
- वेरिएबल घोषणा
- लॉजिक और स्टेटमेंट
- रिटर्न स्टेटमेंट
उदाहरण:
#include <stdio.h>

int main() {
    // कोड यहाँ
    return 0;
}
        

3. What is the role of main() function in C?3. C में main() फ़ंक्शन का क्या कार्य है?

The main() function is the entry point of a C program where execution begins. It returns an integer value to the operating system, usually 0 indicating success. main() फ़ंक्शन C प्रोग्राम का प्रवेश बिंदु होता है जहाँ से प्रोग्राम का कार्य प्रारंभ होता है। यह ऑपरेटिंग सिस्टम को एक पूर्णांक मान लौटाता है, आमतौर पर 0 जो सफलता दर्शाता है।

4. Difference between keywords and identifiers?4. कीवर्ड्स और आइडेंटिफायर्स में क्या अंतर है?

Keywords are reserved words in C with special meaning (like int, return). Identifiers are names created by the programmer for variables, functions, etc., and cannot be keywords. कीवर्ड्स C के आरक्षित शब्द होते हैं जिनका विशेष अर्थ होता है (जैसे int, return)। आइडेंटिफायर्स प्रोग्रामर द्वारा बनाए गए नाम होते हैं जैसे वेरिएबल या फ़ंक्शन के लिए, और ये कीवर्ड्स नहीं हो सकते।

5. Difference between #include <filename> and #include "filename"?5. #include <filename> और #include "filename" में क्या अंतर है?

#include <filename> is used to include system header files searched in standard directories.
#include "filename" is used to include user-defined header files searched in current directory first.
#include <filename> का उपयोग सिस्टम हेडर फाइल्स को शामिल करने के लिए किया जाता है, जो मानक डायरेक्टरीज में खोजी जाती हैं।
#include "filename" का उपयोग यूजर-डिफाइंड हेडर फाइल्स को शामिल करने के लिए किया जाता है, जो सबसे पहले वर्तमान डायरेक्टरी में खोजी जाती हैं।

6. What are data types in C?6. C में डेटा टाइप्स क्या हैं?

Data types specify the type and size of data that variables can hold. Common types: int, char, float, double. डेटा टाइप्स यह निर्दिष्ट करते हैं कि वेरिएबल किस प्रकार और आकार का डेटा रख सकता है। सामान्य प्रकार: int, char, float, double।

7. Difference between signed and unsigned int?7. Signed और unsigned int में क्या अंतर है?

Signed int can store both positive and negative integers.
Unsigned int stores only positive integers (including zero).
Signed int सकारात्मक और नकारात्मक दोनों पूर्णांक रख सकता है।
Unsigned int केवल सकारात्मक पूर्णांक (शून्य सहित) रखता है।

8. Typical size of int, char, float, double?8. int, char, float, double का सामान्य आकार क्या होता है?

Typically:
int = 4 bytes
char = 1 byte
float = 4 bytes
double = 8 bytes
(May vary with compiler and system)
सामान्यतः:
int = 4 बाइट
char = 1 बाइट
float = 4 बाइट
double = 8 बाइट
(कंपाइलर और सिस्टम के अनुसार बदल सकता है)

9. What is variable declaration and initialization?9. Variable declaration और initialization क्या है?

Declaration tells compiler about the variable's type and name.
Initialization assigns an initial value to the variable.
डिक्लेरेशन कंपाइलर को वेरिएबल के प्रकार और नाम के बारे में बताता है।
इनिशियलाइज़ेशन वेरिएबल को प्रारंभिक मान देता है।

10. What are storage classes in C?10. C में storage classes क्या हैं?

Storage classes specify the scope, lifetime, and visibility of variables.
Types: auto, extern, static, register.
Storage classes वेरिएबल की स्कोप, जीवनकाल, और दृश्यता निर्धारित करते हैं।
प्रकार: auto, extern, static, register।