Type Here to Get Search Results !

C Programming MCQ with Answers [ SET - 9 ] | Computer Programming Mcq with Answers

 


1. What is an array?

    An array is a collection of variables that are of the dissimilar data type.
    An array is a collection of variables that are of the same data type.
    An array is not a collection of variables that are of the same data type.
ANSWER= (B) An array is a collection of variables that are of the same data type.

 

2. What is right way to Initialization array?

    int num[6] = { 2, 4, 12, 5, 45, 5 } ;
    int n{} = { 2, 4, 12, 5, 45, 5 } ;
    int n{6} = { 2, 4, 12 } ;
ANSWER= (A) int num[6] = { 2, 4, 12, 5, 45, 5 } ;

 

3. #define max(a, b) a< b? a:b++;

int a; b;

a = 8, b = 9;

printf("%d", max(a.b)); 


The output is -




ANSWER= (D) compilation error.

 

4. Which function is necessary to exist in each & every program?

     void
    sum
     main
ANSWER= (C) main

 

5. What is the answer of: 7%3





ANSWER= (B) 1

 

6. An array elements are always stored in _________ memory locations.

    Sequential
    Random
    Sequential and Random
ANSWER= (A) Sequential

 

7. What is the right way to access value of structure variable book{ price, page }?

     printf(“%d%d”, book.price, book.page);
     printf(“%d%d”, price.book, page.book);
    printf(“%d%d”, price::book, page::book);
ANSWER= (A) printf(“%d%d”, book.price, book.page);

 

8. perror( ) function used to ?

    Work same as printf()
    prints the error message specified by the compiler
     prints the garbage value assigned by the compiler
ANSWER= (B) prints the error message specified by the compiler

 

9. Input/output function prototypes and macros are defined in which header file? 

    conio.h 
     stdlib.h 
    stdio.h
ANSWER= (C) stdio.h

 

10. A function is a subroutine that may include one or more _______ designed to perform a specific task.

    Functions
    Statements
    Libraries
ANSWER= (B) Statements

 

11. What is used as a terminator in C?

a) ?

b) ;

c) :

d) _

Ans: b





ANSWER= (B) ;

 

12. Bitwise operators can operate upon?

    double and chars
    floats and doubles
    ints and floats
ANSWER= (D)  ints and chars

 

13. What is C Tokens?

    The smallest individual units of c program
    The basic element recognized by the compiler
    The largest individual units of program
ANSWER= (D) A & B Both

 

14. What is Keywords?

     Keywords have some predefine meanings and these meanings can be changed.
    Keywords have some unknown meanings and these meanings cannot be changed.
    Keywords have some predefine meanings and these meanings cannot be changed.
ANSWER= (C) Keywords have some predefine meanings and these meanings cannot be changed.

 

15. The keyword used to transfer control from a function back to the calling function is - 

    switch
    goto
    go back
ANSWER= (D) return

 

16. How will you print \n on screen?  

    printf("\n") 
    echo\\n 
    printf("\n') 
ANSWER= (A) printf("\n") 

 

17. When we mention the prototype of a function? 

    Defining 
    Declaring 
    Prototyping 
ANSWER= (B) Declaring 

 

18. The statement printf(“%c”, 100); will print?

     prints 100
     print garbage
    prints ASCII equivalent of 100
ANSWER= (C) prints ASCII equivalent of 100

 

19. In C++, when accessing a structure member, the identifier to the left of the dot operator is the name of

    structure tag
    structure member
    structure variable
ANSWER= (C) structure variable

 

20. How would you round off a value from 1.66 to 2.0 ? 

    ceil(1.66) 
    floor(1.66) 
    roundup(1.66)
ANSWER= (A) ceil(1.66) 

 

21. To represent hierarchical relationship between elements, which data structure is suitable ?

    Priority
    Tree
    Dqueue
ANSWER= (B) Tree

 

22. Which of the following data structure is linear type?

    Strings
    Queue
     Lists
ANSWER= (D)  All of the above

 

23.How many values can be returned from a function?





ANSWER= (A) 1

 

24. A pointer is

    data type of an address variable
     a variable for storing address
    indication of the variable to be accessed next
ANSWER= (B)  a variable for storing address

 

25.Is the following statement a declaration or definition?

extern int i;

    declaration
    definition
    function
ANSWER= (A) declaration

 

26. Is the following statement a declaration or definition? 

extern int i

    Declaration
    Definition
     Function
ANSWER= (A) Declaration

 

27. When fopen() fails to open a file it returns 

    NULL
    -1

ANSWER= (A) NULL

 

28. the EOF is equivalent to - 




ANSWER= (A) -1

 

29.  What is the action of strcmp() function

    compare two strings
    copies one string over another
    finds the length of a string
ANSWER= (A) compare two strings

 

30.  Null character is represented by





ANSWER= (B) \0



Friends if you like this post,kindly comment bellow and do share your responce.Thank You for Visiting.

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Top Post Ad

Below Post Ad