Blog - C Language Quiz 1

C Language Quiz 1

C Language Quiz 1

C Language

1.What is the correct syntax to declare a variable in C?

C में वेरिएबल घोषित करने के लिए सही सिंटैक्स क्या है?

a) var myVar;

b) int myVar;

c) variable myVar;

d) myVar int;

 

2.Which header file is used for input and output operations in C?

C में इनपुट और आउटपुट ऑपरेशन के लिए किस हेडर फ़ाइल का उपयोग किया जाता है?

a) stdlib.h

b) math.h

c) stdio.h

d) string.h 

 

3.In C, how do you end a statement?

C में, आप किसी कथन को कैसे समाप्त करते हैं?

a) With a semicolon (;)

b) With a comma (,)

c) With a period (.)

d) With a colon (:) 

 

4.What is the primary function of the "main" function in a C program?

C प्रोग्राम में "मुख्य" फ़ंक्शन का प्राथमिक कार्य क्या है?

a) To declare variables

b) To perform calculations

c) To print output

d) To specify the program's starting point 

 

5.How do you comment a single line of code in C?

आप C में कोड की एक पंक्ति पर कैसे टिप्पणी करते हैं?

a) /* This is a comment */

b) // This is a comment

c) ' This is a comment '

d) # This is a comment #

 

6. What does the "sizeof" operator in C return?

C में "sizeof" ऑपरेटर क्या लौटाता है?

a) The size of a data type in bytes

b) The value of a variable

c) The square root of a number

d) The current date and time 

 

7.Which data type is used for storing characters in C?

C में कैरेक्टर्स को स्टोर करने के लिए किस डेटा प्रकार का उपयोग किया जाता है?

a) char

b) int

c) float

d) double

 

8.In C, what does the "scanf" function do?

C में, "scanf" फ़ंक्शन क्या करता है?

a) Prints text to the screen

b) Reads input from the user

c) Performs arithmetic calculations

d) Declares a variable 

 

9. Which operator is used for logical AND in C?

C में लॉजिकल AND के लिए किस ऑपरेटर का उपयोग किया जाता है?

a) &&

b) ||

c) !

d) &

 

10. What is the result of the expression 5 + 7 / 2 in C?

C में व्यंजक 5 + 7/2 का परिणाम क्या है?

a) 6

b) 7

c) 8

d) 9

 

11. How do you declare a constant in C?

आप C में स्थिरांक की घोषणा कैसे करते हैं?

a) const myConst = 10;

b) constant myConst = 10;

c) int myConst = 10;

d) #define myConst 10

 

12. What does the "break" statement do in a switch statement in C?

C में स्विच स्टेटमेंट में "ब्रेक" स्टेटमेंट क्या करता है?

a) Ends the program

b) Exits the loop

c) Skips to the next case

d) Continues to the next iteration of the loop

 

13. What is the purpose of the "else" statement in an "if-else" construct in C?

सी में "अगर-और" निर्माण में "अन्य" कथन का उद्देश्य क्या है?

a) To start a new if statement

b) To specify the condition

c) To define the actions if the condition is false

d) To end the program 

 

14. What does the "++" operator do in C?

सी में "अगर-और" निर्माण में "अन्य" कथन का उद्देश्य क्या है?

a) Decrements a variable by 1

b) Multiplies a variable by 2

c) Increments a variable by 1

d) Divides a variable by 2

 

15. What is the correct way to declare an array of integers with 10 elements in C?

C में 10 तत्वों के साथ पूर्णांकों की एक सरणी घोषित करने का सही तरीका क्या है?

a) int[10] myArray;

b) int myArray[10];

c) myArray = int[10];

d) myArray[10] = int;

 

16. Which function is used to allocate memory dynamically in C?

C में मेमोरी को गतिशील रूप से आवंटित करने के लिए किस फ़ंक्शन का उपयोग किया जाता है?

a) calloc()

b) malloc()

c) realloc()

d) free()

 

17. How do you access the first element of an array in C?

आप C में किसी सरणी के पहले तत्व तक कैसे पहुँचते हैं?

a) array[0]

b) array[1]

c) array[-1]

d) array[10]

 

18. What is the purpose of the "return" statement in a function in C?

C में किसी फ़ंक्शन में "रिटर्न" स्टेटमेंट का उद्देश्य क्या है?

a) To declare a variable

b) To perform arithmetic operations

c) To exit the function and return a value

d) To print output to the screen

 

19. What is the result of the expression 10 % 3 in C?

C में अभिव्यक्ति 10% 3 का परिणाम क्या है?

a) 0

b) 1

c) 2

d) 3

 

20. How do you declare a pointer variable in C?

आप C में पॉइंटर वेरिएबल कैसे घोषित करते हैं?

a) ptr myPtr;

b) myPtr pointer;

c) int *myPtr;

d) myPtr = int;

 

21. In C, what does the "fprintf" function do?

C में, "fprintf" फ़ंक्शन क्या करता है?

a) Reads input from the user

b) Prints text to the screen

c) Reads input from a file

d) Writes formatted output to a file 

 

22. What is the purpose of the "typedef" keyword in C?

C में "typedef" कीवर्ड का उद्देश्य क्या है?

a) To declare a new variable

b) To define a new data type

c) To perform typecasting

d) To declare a constant 

 

23. What is the difference between "++i" and "i++" in C?

C में "++i" और "i++" के बीच क्या अंतर है? क) कोई अंतर नहीं है; वे समतुल्य हैं.

a) There is no difference; they are equivalent.

b) "++i" increments the value of i before using it; "i++" increments it after using it.

c) "++i" decrements the value of i before using it; "i++" decrements it after using it.

d) "++i" multiplies the value of i by 2; "i++" multiplies it by 3.

 

24. Which library function is used to find the length of a string in C?

C में स्ट्रिंग की लंबाई ज्ञात करने के लिए किस लाइब्रेरी फ़ंक्शन का उपयोग किया जाता है?

a) len()

b) size()

c) length()

d) strlen()

 

25. What is the purpose of the "static" keyword when applied to a variable in C?

C में किसी वेरिएबल पर लागू होने पर "स्थैतिक" कीवर्ड का उद्देश्य क्या है?

a) It declares a variable with global scope.

b) It initializes a variable.

c) It restricts the variable's visibility to the current function.

d) It declares a constant variable.

 


56 8 months ago