C Language Interview Question In Hindi/ C Questions हिंदी में
हेलो friends , आज के इस blog(C Language Interview Question In Hindi) में मैं आपको interview और viva में पूंछे जाने वाले c language के question के बारे में बताने जा रहा हूँ| अगर आपने इन सभी ‘C’ questions and answers को अच्छे से एक बार पढ़ लिया तो चाहे job interview हो या आपके कॉलेज का viva हो, आप इन c लैंग्वेज के question का आसानी से answer कर पाएंगे|
C Language Interview Question In Hindi:
c language में function /variable के declaration और definition में क्या अंतर होता है ?|C Language Interview Question In Hindi!
जब भी c program में किसी variable या function को declare किया जाता है तो, वह variable या function उस program में exist करने लगते है, पर अभी उस variable या function के लिए उस प्रोग्राम में memory allocate नहीं होती है |C Language Interview Question In Hindi|
पर variable और function को declare करने का यह फायदा हो जाता है कि, program को उनके data type पता चल जाता है | वेरिएबल के case में उसका data type , और function के case में उसके argument का data type और function का return type का पता प्रोग्राम को चल जाता है |
और जब हम variable या function को define करते है है तब program इनके लिए memory allocate करता है | हम एक प्रोग्राम में एक variable या function को एक या एक से ज्यादा बार declare कर सकते है पर उन्हें define केवल एक बार करते है | कहने का मतलब यह है कि एक variable /function के लिए दो memory allocation नहीं हो सकते |
c language में storage class specifier कौन कौन से है ?
c language में storage class specifier निम्नलिखित है |
Auto , register, static एंड extern |
c language में variabl के scope को समझाइये?
c लैंग्वेज में variable का स्कोप static होता है, c में मुख्य रूप से चार तरह के scope होते है|
File Scope :
प्रोग्राम में ऐसे identifier जिनका openning brace program के शुरु में start होता है और closing brace end में ख़तम होता है | ऐसे identifier को global identifier भी कहते है, इनको प्रोग्राम में कही से भी access कर सकते है, प्रोग्राम में लिखा कोई भी variable और function इसे access कर सकता है |
Block Scope:
curly braces के अंदर declare variable block scope variable कहलाते है, इनका scope curly braces के अंदर ही होता है या फिर इस के अंदर मौजूद और कोई block भी इन varibale को एक्सेस कर सकता है |
function prototype scope :
जब कोई भी variable function prototype के साथ declare किये जाते है तब उनका scope केबल function prototype तक ही होता है |
Function scope :
जब कोई भी variable किसी function के अंदर define किया जाता है तो उसका scope केबल उस function के अंदर तक ही होता है|
बिना सेमि कोलन के “हेलो वर्ल्ड” कैसे प्रिंट करेंगे ?
#include <stdio.h>
int main(void)
{
if (printf(“Hello World”)) {
}
}
हमें C लैंग्वेज में pointer का use कब करना चाहिए?
Variable का address पता करने के लिए|
c में pointer functions को उनके local variable को share and modify करने के लिए allow करता है, जिससे pass by refrence के तहत किसी भी फंक्शन में variable कि actual वैल्यू की जगह उसका refrence पास करते है |
किसी large structure को पास करने के लिए, जिससे कि उस स्ट्रक्चर की पूरी बॉडी कॉपी न करना पड़े |
Linklist और binary tree के implementation में |
c languag में null pointer क्या है ?
Null pointer का मतलब यह है की, pointer किसी गलत value को point कर रहा है | अगर हम pointer को declare करते टाइम पर कोई भी वैल्यू assign OR उसको initialize नहीं कर रहे है तो हमें उसे उस पॉइंटर को null declare करना चाहिए|
और अगर program के बीच में किसी pointer की value deallocate हो रही है तो भी उसे null declare करना चाहिए|
c लैंग्वेज में dangling pointer क्या है ?
dangling pointer वह pointer है जो कि एक गलत memory location को point करता है, यह स्तिथि तब बनती है जब program में किसी object को delete कर देते है या फिर deallocate कर देते है बिना pointer की value modify किये हुए|
इससे हमारा pointer किसी भी गलत memory location को point करने लगता है |
// EXAMPLE:
int* ptr = NULL
{
int x = 10;
ptr = &x;
}
// x goes out of scope and memory allocated to x is free now.
// So ptr is a dangling pointer now.
c language में मेमोरी leak क्या है, और इसे क्यों रोकना चाहिए?
C language में जब कोई programmer heap के फॉर्म में memory create करता है और बाद में उसे delete करना भूल जाता है, तब इस incident को memory लीक कहते है |
यह प्रोग्राम्स के लिए लिए बहुत ही सीरियस issue है खास तौर पर daemons (बैकग्राउंड program और process) प्रोग्राम और server program जो कि कभी terminate नहीं होते|
/* Function with memory leak *
/#include <stdlib.h>
voidf() { int* ptr = (int*)malloc(sizeof(int)); /* Do some work */return; /* Return without freeing ptr*/}
c लैंग्वेज में local static variable क्या है? और उनका use क्या है ?
Local static variable वह होता है जिसका life time कभी भी function कॉल के साथ ख़तम नहीं होता | यह program के complete होने तक लाइव रहता है |
सभी function calls इस local static variable की एक ही कॉपी शेयर करते है | यह variable function कॉल को count करने में use हो सकते है, कि एक program में एक function कितनी बार execute हुआ है | इस static variable की default वैल्यू 0 होती है |
#include <stdio.h>
void fun()
{
// static variables get the default value as 0.
static int x;
printf(“%d “, x);
x = x + 1;
}
int main()
{
fun();
fun();
return 0;
}
// Output: 0 1
c language में static function क्या होता है ? और उनका use क्या है?
By default c में सारे function global होते है, मतलब कि उन्हें कोई भी access कर सकता है | पर अगर हम किसी function के आगे static keyword लगा देते है है तो वो function static हो जाता है, मतलब उस function को अब सिर्फ वही से access किया जा सकता है जहा पर वो declare है |
इसलिए जब भी हमें किसी भी function को restrict करना होता है तो हम उसे static declare कर देते है | और function को static declare करने का एक और फायदा यह है कि उसका funciton नाम कोई दूसरी file में use नहीं कर पाता| इससे हम function नाम के reuse को रोक देते है |
c language की main characteristic क्या है ?
c एक procedure language है , इसकी main charateristic है low level access to memory , simple keywords , और program लिखने की clean style |
c की यही सारी विशेषता इसे system programming के लिए उपर्युक्त बनाती है जैसे कि operating system और compiler development |
i ++ और ++i में क्या difference है ?
i ++ पुरानी value को return करता है और फिर increment करता है | जबकि ++i में पहले increment होता है और फिर नयी वैल्यू return होती है |
c लैंग्वेज में सबसे छोटा executable कोड लिखिए?
void main()
{
}
c language में Entry control loop और Exit control loop क्या है?
c केवल दो loop support करता है |
Entry control loop :
while loop
For loop
Exit control loop :
do-while loop
c languag में use होने वाले preprocessor directives के last में semi colon क्यों नहीं लगा होता है ?
जो भी program और statement compiler द्वारा execute होते है उन्हें semi colon कि जरुरत होती है पर जैसा कि इस का नाम है preprocessor , यह यह program compilation के पहले ही execute हो जाता है इसलिए इसमें semi colon की जरुरत नहीं पड़ती|
angular braces < > के बीच रखी file और double quotes ” ” के बीच राखी file में क्या difference होता है ?
c languag में अगर कोई header file < > angular braces में रखी होती है तो compiler सबसे पहले फाइल को built _in include path में ढूढ़ता है |
और अगर फाइल ” ” double quotes के बीच रखी होती है तो compiler सबसे पहले फाइल को अपनी current working directory में देखता है और अगर वहां पर नहीं मिलती तब जा कर built _in include path में देखता है |
Near, Far, and Huge pointers में क्या difference है ?
यह concept MS DOS के jamane में 16 bit intel architecture में use होने वाला बहुत पुराना concept है, और आज के टाइम में इसका ज्यादा उपयोग नहीं है |
Near Pointer : यह pointer 16 bit address को store करने के लिए उपयोग होता है with the current segment on 16 bit machine| basically इसकी मदद से हम 64kb का डाटा एक बार में access कर सकते है |
Far pointer : यह एक 32 bit pointer होता है और यह अपने segment के बाहर भी memory access कर सकता है | इसके लिए compiler एक segment register allocate करता है जिसमे segment address store किया जाते है |
Huge pointer : huge pointer भी 32 bit store कर सकता है और यह भी अपने segment के बाहर memory access कर सकता है | far pointer के case में segment fix होता है और उसे modify नहीं किया जा सकता पर huge pointer के केसे में segment को modify किया जा सकता है |
c language में Stack और heap area क्या है ?
Heap area : इसका उपयोग object को dynamic memory allocate करने के लिए किया जाता है | malloc () और calloc () फंक्शन का उपयोग करके मेमोरी allocate की जाती है |
Stack area : इसका use method में use होने वाले local variable और arguments को store करने के लिए होता है | यह memory में तब तक ही रहता है जबतक method का termination नहीं हो जाता |C Language Interview Question In Hindi|
You can also go through a few more amazing blog links related to C/C++:
Problems of procedure-oriented language in Hindi…
This Pointer In C++ In Hindi…
how to learn c language easily…
C Language Interview Question In Hindi…
Looping In C In Hindi…
Switch Statement In C In Hindi…
IF Statement In C In Hindi…
IF-Else Statement In C In Hindi…
Nested If-Else Statement In C In Hindi…
Top to bottom vs Bottom-up programming approach in Hindi…
इस ब्लॉग ‘C Language Interview Question In Hindi’को लेकर आपके मन में कोई भी प्रश्न है तो आप हमें इस पते a5theorys@gmail.com पर ईमेल लिख सकते है|
आशा करता हूँ, कि आपने इस पोस्ट ‘C Language Interview Question In Hindi.’ को खूब एन्जॉय किया होगा|
आप स्वतंत्रता पूर्वक अपना बहुमूल्य फीडबैक और कमेंट यहाँ पर दे सकते है|C Language Interview Question In Hindi|
आपका समय शुभ हो|