Type Here to Get Search Results !

C Programming MCQ with Answers [ SET - 6 ] | C Programming mcq Diploma

 

C Programming mcq Diploma

1. Which symbol is used as a statement terminator in C?





ANSWER= (D) ;

 

2.  What will be output if you will compile and execute the following c code?

struct marks{

int p:3;

int c:3;

int m:2;

};

void main(){

struct marks s={2,-6,5};

printf(“%d %d %d”,s.p,s.c,s.m);

}

    2 -6 5
    2 -6 1
     2 2 1
ANSWER= (C) 2 2 1

 

3. Pointers are of

    Integer data type
    Character data type
    Unsigned integer data types
ANSWER= (D)  None of these

 

4. Identify the invalid pointer arithmetic

    Addition of float value to a pointer
    Comparison of pointers that do not point to the element of the same array
    Subtracting an integer from a pointer
ANSWER= (A) Addition of float value to a pointer

 

5.  …… is a library function used in C to display any output to the terminal. The text to be printed is enclosed in ……. quotes.

    Printf, Single
    Printf, double
    Scanf, double
ANSWER= (B) Printf, double

 

6. Following declaration in C++ -

int x ; int &p = x;

is same as the declaration

int x, *p; p =&x;

This remark is

    true
    false
    sometimes true
ANSWER= (B) false

 

7.  Which is more appropriate for reading in a multiword string? 

     gets() 
    fgets() 
    scanf( 
ANSWER= (A) gets() 

 

8. char name [] = {'T', 'W', 'D','T', 'A', '\0');

 printf("%d", strlen (name));


The output is





ANSWER= (A) 6

 

9. What will be output if you will compile and execute the following c code?

void main(){

int a,b;

a=1,3,15;

b=(2,4,6);

clrscr();

printf(“%d “,a+b);

getch();

}





ANSWER= (D) 7

 

10. Which of the following symbol is used to denote a pre-processor statement?





ANSWER= (B) #

 

11.Which of the following is a Scalar Data type

    Float
    Union
    Array
ANSWER= (A) Float

 

12. What is the output?

char a[]="ABCD", b[ ]= "abcd": 

strcpy(b,a);

printf("%s %s", a, b);

    abcd ABCD,
    ABCD ABCD. 
    ABCD abcd,
ANSWER= (B) ABCD ABCD. 

 

13. The _______ memory allocation function modifies the previous allocated space.

    calloc
    free
     malloc
ANSWER= (D) realloc

 

14. Number of binary trees formed with 5 nodes are





ANSWER= (D) 42

 

15.  In C, if you pass an array as an argument to a function, what actually gets passed ?

    Value of elements in array 
    First of elements of the array 
    Base address of the array
ANSWER= (C) Base address of the array

 

16. The Default Parameter Passing Mechanism is called as

    Call by Value
    Call by Reference
    Call by Address
ANSWER= (A) Call by Value

 

17. C is _______ type of programming language.?

     Object Oriented
    Procedural
    Bit level language
ANSWER= (B) Procedural

 

18. What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array ? 

    The element will be set to 0
    The compiler would report an error 
     The program may crash if some important data gets overwritten would appropriately grow
ANSWER= (C)  The program may crash if some important data gets overwritten would appropriately grow

 

19. In which tree, for every node the height of its left subtree and right subtree differ almost by one?

     Binary search tree
    AVL tree
    Threaded Binary Tree
ANSWER= (B) AVL tree

 

20. What is the present C Language Standard.?

     C99 ISO/IEC 9899:1999
    C11 ISO/IEC 9899:2011
    C05 ISO/IEC 9899:2005
ANSWER= (B) C11 ISO/IEC 9899:2011

 

21. If the two strings are identical, then strcmp() function returns




ANSWER= (C) 0

 

22. An _______ is a fixed size sequence collection of elements of the same data type

     integer
    function
    array
ANSWER= (C) array

 

23. Array passed as argument to a function is treated as: 

    Address of the array
    Value of the first element of the array 
    Address of the first element of the array
ANSWER= (C) Address of the first element of the array

 

24. The library function strcmp("abc","ABC"); returns





ANSWER= (D) 1

 

25. Which of the following function is used for sets the position to a desired point in the file

    putc()
    putw()
    fseek()
ANSWER= (C) fseek()

 

26.  If you want to exchange two rows in a two-dimensional array, the fastest way is to:

    Exchange the elements of the 2rows
    Exchange the address of each element in the two rows
    Silence the address of the rows in an array of the pointer and exchange the pointer
ANSWER= (C) Silence the address of the rows in an array of the pointer and exchange the pointer

 

27. An array is passed to a function as argument to the function in C language equivalent

     call by value 
    call by reference 
    call by name
ANSWER= (B) call by reference 

 

28.  …… allows the programs to interact with the screen, keyboard and file system of your computer.

    # include (stdio.h>
    #include <file.h>
    #include <conio.h>

ANSWER= (A) # include (stdio.h>

 

29.In C++ , following statement -

Class z : public X , public Y is an example of -

    multiple inheritance
    Multilevel Inheritance
    linear Inheritance

ANSWER= (A) multiple inheritance

 

30. Write the output of the following program fragment:

main()

{

printf("Hello World"); 

main();

}

 

    compilation error
     run time error
     infinite loop
ANSWER= (C) infinite loop








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.

Below Post Ad