QUIZ-6 OF C PROGRAMMING LANGUAGE

quij of c at soluversity

QUIZ- 5 OF C PROGRAMMIMG LANGUAGE

 

 

Here some question about programming language c with explanation.This is more useful for all graduation student specially B.Sc(IT) and BCA students.this MCQ also helpful for MCA students.so have a look on these MCQ.

Q-1):WHAT IS THE OUTPUT OF THE PROGRAM?

#include<stdio.h>

#include<conio.h>

Main()

{

int x=5;

int arr[x];

arr[1]=12;

printf(“%d”,arr[1]);

getch();

}

 

 

Q-2):THE OUTPUT OF THE FOLLOWING CODE IS NOT AS DESIRED.IDENTIFY THE ERROR.

#include<stdio.h>

#include<conio.h>

Main()

{

int x[5]={1,2,3,4,5};

int  i;

clrscr();

for (i=0;i<20;i++)

printf(“\n%d”,x[i]);

getch();

}

 

 

Q-3):THE OUTPUT OF THE FOLLOWING CODE IS NOT AS DESIRED.IDENTIFY THE ERROR.

#include<stdio.h>

#include<conio.h>

Main()

{

int x[50],i;

clrscr();

for (i=0;i<=50;i++)

{

X[i]=i;

Printf(“\n %d”,x[i]);

}

getch();

}

 

 

Q-4)what is the output of following program?

Main()

{

Int num=10;

Fun(num);

Printf(“%d”,num);

}

Fn(int num)

{

Return ++num;

}

 

 

 

Q-5)How many times will ‘UVCE’ be printed?

Main()

{

Printf(“\n UVCE”);

MAIN();

}

 

 

Q-6) What is output of the program?

#include <stdio.h>

#include <conio.h>

Void main(int x)

{

Clrscr();

Printf(“%d”,x);

Getch();

}

 

 

Q 7 – The type name/reserved word ‘short’ is ___

A – short long

B – short char

C – short float

D – short int

 

Q 8 – Compiler generates ___ file.

A – Executable code

B – Object code

C – Assembly code

D – None of the above.

 

Q 9 – What is the output of the following program?

#include<stdio.h>

 

main()

{

char s[] = “Fine”;

*s = ‘N’;

 

printf(“%s”, s);

}

A – Fine

B – Nine

C – Compile error

D – Runtime error

 

Q 10 – What is the output of the following program?

#include<stdio.h>

 

main()

{

char s[20] = “Hello\0Hi”;

 

printf(“%d %d”, strlen(s), sizeof(s));

}

A – 5 9

B – 7 20

C – 5 20

D – 8 20

 

 

QUIZ-6 OF C PROGRAMMING LANGUAGE

Answer with explanation

1)Errors:

constant expression required in function main.size of array not known in function main solution:We cannot initialize  an array using a variable i.e,the size of array should be known at the compile time.Declare the array as:int arr[5];

 

2)Error:Program executes but the value displayed for remaining array indices are garbage values.

     Solution:There is no bound checking in c.Loop should iterate from 0 to 4 only.

 

3)Error:

program compiles successfully but may give undesired values in the output

     Solution:the valid indices are 0 to 49.

 

4) OUTPUT: 10

 

5)OUTPUT: T

ill the stack does not overflow.

 

6)output: 1

Explanation:   

x gives number of arguments given while invoking the command.

 

7)D

Explanation

short is used as an alternative of short int.

 

8)B

Explanation

 Compilation is the process of translating high level language statements into equivalent machine code, which is object code.

 

9)B

Explanation

*s=’N’, changes the character at base address to ‘N’.

10)C

Explanation

Length of the string is count of character upto ‘\0’. sizeof – reports the size of the array.

 

 

To get more quiz on “programming language c with explanation”please click here:

https://www.soluversity.in/quiz-5-of-c-programming-language

TO know more about c programming language visit there:

https://en.wikipedia.org/wiki/C_(programming_language)

You may also like...

2 Responses

  1. Prabhat Singh says:

    awesome series of quizes….

Leave a Reply

Your email address will not be published. Required fields are marked *