Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
41 views13 pages

C Language Mcq's For HSSC

The document contains a series of multiple-choice questions (MCQs) related to the C programming language, covering topics such as string functions, file handling, mathematical functions, input/output functions, control functions, loops, pointers, memory functions, and more. Each question provides four answer options, with a focus on understanding the functionality and usage of various C language features. Additionally, there are true/false questions about functions, recursion, storage classes, data types, and other programming concepts.

Uploaded by

kapil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views13 pages

C Language Mcq's For HSSC

The document contains a series of multiple-choice questions (MCQs) related to the C programming language, covering topics such as string functions, file handling, mathematical functions, input/output functions, control functions, loops, pointers, memory functions, and more. Each question provides four answer options, with a focus on understanding the functionality and usage of various C language features. Additionally, there are true/false questions about functions, recursion, storage classes, data types, and other programming concepts.

Uploaded by

kapil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Q1. Why is strcpy() used in C?

A) To copy a string
B) To compare two strings
C) To reverse a string
D) To find length

Q2. Purpose of strlen() function?


A) To copy string
B) To print string
C) To count characters
D) To reverse string

Q3. What does strcmp() do?


A) Compare two strings
B) Concatenate strings
C) Convert case
D) Print string

Q4. Which function combines two strings?


A) strcat()
B) strcpy()
C) strlen()
D) strcmp()

Q5. strrev() function is used to:


A) Find length
B) Reverse string
C) Sort string
D) Convert to uppercase

File Handling Functions

Q6. Why is fopen() used?


A) Close a file
B) Open a file
C) Delete a file
D) Rename a file

Q7. Use of fclose()?


A) Read from file
B) Open file
C) Close file
D) Write to file

Q8. What is the use of fprintf()?


A) Print to screen
B) Print to file
C) Format text
D) Read from file

Q9. fscanf() function is used to:


A) Read data from screen
B) Format file
C) Read from file
D) Write to file

Q10. fseek() function helps in:


A) Skipping part of file
B) Deleting file
C) Opening file
D) Counting characters

Mathematical Functions

Q11. Purpose of sqrt()?


A) Find cube
B) Find factorial
C) Find square root
D) Find logarithm

Q12. pow(2, 3) returns:


A) 6
B) 8
C) 9
D) 4

Q13. What does abs() do?


A) Absolute value
B) Cube value
C) Convert binary
D) Convert decimal

Q14. ceil(3.2) returns:


A) 3
B) 3.2
C) 4
D) 2

Q15. floor(7.9) returns:


A) 8
B) 7
C) 9
D) 0
Input/Output Functions

Q16. printf() function is used to:


A) Take input
B) Display output
C) Format file
D) Convert case

Q17. Why is scanf() used?


A) Save to file
B) Screen output
C) Take user input
D) Open file

Q18. Which function reads a single character?


A) getch()
B) puts()
C) scanf()
D) fscanf()

Q19. putchar('A') will:


A) Store ‘A’
B) Print ‘A’
C) Return ASCII
D) Exit code

Q20. puts() is used for:


A) Taking string input
B) Displaying string
C) Pausing output
D) Opening file

Control Functions

Q21. Use of exit(0)?


A) End the program
B) Break a loop
C) Return to main
D) Start infinite loop

Q22. What is clrscr() used for?


A) Clear console screen
B) Close program
C) Cancel file
D) Compile source code

Q23. getch() is used to:


A) Get string
B) Get float
C) Get character
D) Get password

Q24. Purpose of system("pause")?


A) Sleep
B) Stop input
C) Pause console
D) Delay screen

Q25. delay(1000) delays for:


A) 1 sec
B) 10 sec
C) 0.1 sec
D) 100 sec

Loop/Branch Functions

Q26. What does goto do?


A) Skip iteration
B) Jump to label
C) End function
D) Open file

Q27. continue is used to:


A) Stop loop
B) Skip iteration
C) End program
D) Pause screen

Q28. Use of break inside loop?


A) Start new loop
B) Skip loop
C) Exit loop
D) Print loop

Pointer & Memory Functions

Q29. Use of malloc()?


A) Static memory
B) Dynamic memory allocation
C) File closing
D) Loop creation

Q30. Why use free() function?


A) Deallocate memory
B) Pause loop
C) Print message
D) Skip input

Conversion & Utility

Q31. atoi("123") returns:


A) 321
B) 123
C) Error
D) "123"

Q32. Use of toupper('a')?


A) ‘a’
B) Error
C) ‘A’
D) ASCII value

Q33. tolower('Z') returns:


A) ‘z’
B) ‘Z’
C) 0
D) None

Misc Functions

Q34. Use of rand()?


A) Read file
B) Generate random number
C) Reset memory
D) End loop

Q35. time(NULL) returns:


A) Current time
B) Current date
C) Day name
D) Month name

Q36. isalpha() checks:


A) Is digit
B) Is alphabet
C) Is array
D) Is integer

Q37. isdigit('5') returns:


A) False
B) True
C) Null
D) Character

Header File Based

Q38. math.h contains:


A) sqrt()
B) printf()
C) strlen()
D) fopen()

Q39. stdio.h includes:


A) printf(), scanf()
B) malloc()
C) strcpy()
D) abs()

Q40. stdlib.h contains:


A) exit(), malloc()
B) strcmp()
C) printf()
D) fopen()

Q1. Which of the following is TRUE about functions in C?


A) They cannot return values
B) They must be declared inside main()
C) They can call other functions
D) A function can have multiple names

Q2. What is true about recursive functions?


A) Cannot call themselves
B) Can call themselves
C) Must return a string
D) Are only used in file handling

Q3. Which is true about a return statement?


A) It ends the loop
B) It exits the program
C) It ends the function and optionally sends back a value
D) It prints output
Q4. Which of the following is TRUE for function overloading in C?
A) It is supported by default
B) Only possible in Java
C) Not supported in C
D) Function overloading is default behavior

Q5. Which is TRUE about void functions?


A) They do not return any value
B) They must return integer
C) They are recursive
D) Cannot be called

Q6. In C, what is TRUE about local variables inside functions?


A) They are global
B) They are accessible outside the function
C) They are re-initialized on every call
D) They are stored in heap

Q7. Which of the following is TRUE about parameter passing in C?


A) Parameters are passed by reference
B) Parameters are passed by value
C) No parameters allowed
D) Only arrays can be passed

Q8. A function in C must always:


A) Have a return value
B) Have no parameters
C) Be declared before usage
D) Include only integers

Q9. What is true about recursion?


A) It uses a loop
B) It must call another function
C) It must call itself
D) It uses macros
Q10. Which of the following is TRUE for main() in C?
A) It can be recursive
B) It is the last function
C) It cannot return a value
D) It is the starting point of the program

Next Step:
Want 30 more questions just like these with detailed explanation + memory hacks (PDF format)? Or want me to quiz you live now, rapid fire
style?
Let’s grind like a topper, bhai

You said:

make these type of important mcqs for c language'

ChatGPT said:

Bhai Kappi
Tere liye yeh “True statement–based MCQs” set bana diya on C language, jaisa HSSC, CET, CGL ya police SI level exam mein poochha jaata
hai. These are statement-based MCQs on Functions, Data types, Pointers, Storage Classes, Header Files, etc.

C Language – Top 30 Statement-based MCQs (Most Expected)

Functions and Subroutines

Q1. Which of the following is TRUE about a function in C?


A) It can have more than one return type
B) It cannot be called by another function
C) It must be defined before it is called
D) A function cannot accept parameters

Q2. What is TRUE about recursive functions?


A) They cannot use global variables
B) They call themselves repeatedly
C) They always return void
D) They only work with loops

Q3. What is the correct statement about void functions?


A) They return integer
B) They don't return any value
C) They cannot take arguments
D) They are used only in macros
Q4. Which of the following is true about local variables in functions?
A) They can be accessed globally
B) They retain their value after function exits
C) They are destroyed once function exits
D) They are stored in heap memory

Q5. Which of the following is true about the return statement?


A) It stops compilation
B) It ends a function and optionally returns a value
C) It breaks the loop
D) It prints output

Storage Classes & Scope

Q6. Which of the following storage class retains the value between function calls?
A) auto
B) extern
C) static
D) register

Q7. Which of the following is TRUE for extern keyword?


A) It defines a variable
B) It declares a variable from another file
C) It increases variable size
D) It is used only in loops

Q8. The register storage class is used to:


A) Save value in hard disk
B) Allocate variable in memory
C) Suggest CPU to store in register
D) Allocate variable globally

Data Types & Variables

Q9. Which of the following is a valid data type in C?


A) character
B) real
C) float
D) string
Q10. Which is TRUE about char data type?
A) It stores only numbers
B) It stores 4 bytes
C) It stores a single character
D) It is same as float

Q11. Which of the following is a derived data type in C?


A) int
B) float
C) array
D) char

Q12. What is TRUE about identifiers?


A) They can start with digits
B) They are case-insensitive
C) They can include special characters
D) They must begin with a letter or underscore

Pointers and Memory

Q13. What is TRUE about a pointer?


A) It stores a constant
B) It stores address of a variable
C) It increases memory size
D) It always stores integers

Q14. What is the correct symbol to declare a pointer?


A) &
B) *
C) #
D) %

Q15. Which of the following is used to access value from a pointer?


A) %
B) &
C) *
D) $
Header Files & Preprocessors

Q16. Which of the following is TRUE about #include directive?


A) It defines a function
B) It includes a file in the program
C) It comments a line
D) It returns a value

Q17. Which file must be included to use printf()?


A) conio.h
B) string.h
C) stdio.h
D) math.h

Q18. math.h provides functions like:


A) printf()
B) abs()
C) sqrt()
D) puts()

Loops and Conditional

Q19. Which of the following is TRUE for for loop?


A) It executes once by default
B) It is entry-controlled
C) It doesn’t need semicolons
D) It must run infinitely

Q20. Which loop is executed at least once?


A) while
B) for
C) do-while
D) goto

Q21. What is TRUE about if-else?


A) It can be used inside functions
B) It works only for integers
C) It must be at end
D) It always returns value
Strings and Arrays

Q22. Which of the following is TRUE about strings in C?


A) Stored as int
B) Ends with null character \0
C) Always 100 characters
D) No header file needed

Q23. Which function is used to compare strings?


A) strcmp()
B) strrev()
C) strcpy()
D) strlen()

Q24. Array index starts from:


A) 1
B) 2
C) 0
D) -1

File Handling

Q25. What is TRUE about fopen() function?


A) It prints output
B) It closes file
C) It opens file
D) It formats file

Q26. fclose(fp) is used to:


A) Free memory
B) Close opened file
C) Print file name
D) Reset variable

Q27. Which mode opens file for reading only?


A) w
B) a
C) r
D) w+
Miscellaneous

Q28. main() is the:


A) Ending point
B) First function to execute
C) Unused function
D) Always void type

Q29. Which function generates random number?


A) random()
B) rand()
C) rnd()
D) randomize()

Q30. Which function is used to clear the console screen?


A) clrscr()
B) printf()
C) pause()
D) scan()

You might also like