Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

MCQ

100 Multiple Choice Questions In C Programming – Part 7

This collection of 100 Multiple Choice Questions and Answers (MCQs) In C Programming : Quizzes & Practice Tests with Answer focuses on “C Programming”.
 

1. Which of these variable types matches a pointer?

A int

B float *

C long

D char

 

2. What is the output of the following C program?
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#include <stdio.h>
void main()
{
float a = 0.2;
printf("%d, ", a);
printf("%f", a);
}
#include <stdio.h> void main() { float a = 0.2; printf("%d, ", a); printf("%f", a); }
#include <stdio.h>

void main()
{
     float a = 0.2;
     printf("%d, ", a);
     printf("%f", a);
}

A 0, 0.999999

B 0, 0.200000

C Junk value, 0.200000

D 0.200000, junk value

 
[st_adsense]  

3. In which order does the compilation occur?

A Preprocessor – Compiler – Linker

B Compiler – Linker – Preprocessor

C Linker – Preprocessor – Compiler

D Preprocessor – Linker – Compiler

 

4. What is the output of the following C program?
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#include <stdio.h>
void main()
{
double a = 14728749.22;
int b = a;
printf("%d\n", b);
printf("%lf\n", b);
}
#include <stdio.h> void main() { double a = 14728749.22; int b = a; printf("%d\n", b); printf("%lf\n", b); }
#include <stdio.h>

void main()
{
     double a = 14728749.22;
     int b = a;
     printf("%d\n", b);
     printf("%lf\n", b);
}

A 1472874, 0.000000

B 1472874, 1472874.0

C 14728749, 14728749.22

D 0, 0.0

 

5. What is the output of the following C program?
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#include <stdio.h>
void main()
{
int a = 97;
char b = a;
printf("%c\n", b);
}
#include <stdio.h> void main() { int a = 97; char b = a; printf("%c\n", b); }
#include <stdio.h>

void main()
{
     int a = 97;
     char b = a;
     printf("%c\n", b);
}

A 97

B b

C a

D Depends on compiler

 
[st_adsense]  

6. When a double is converted to a float, its value is _____?

A Rounded

B Truncated

C Depends on compiler

D Depends on the standard

 

7. What does the following code give: &A ?

A The address of the variable A

B The value of the variable A

C The value of the variable to which A points

D None of the above

 

8. What is the output of the following C program?
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#include <stdio.h>
int main()
{
int i = 15;
char c = -15;
if (i < c)
printf("15 < -15\n");
else
printf("15 > -15\n");
}
#include <stdio.h> int main() { int i = 15; char c = -15; if (i < c) printf("15 < -15\n"); else printf("15 > -15\n"); }
#include <stdio.h>

int main()
{
     int i = 15;
     char c = -15;
     if (i < c)
         printf("15 < -15\n");
     else
         printf("15 > -15\n");
}

A 15 < -15

B 15 > -15

C Depends on compiler

D Depends on the standard

 
[st_adsense]  

9. What does the following code give: *A ?

A The address of the variable A

B The value of the variable A

C The value of the variable to which A points

D None of the above

 

10. What is the output of the following C program?
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#include <stdio.h>
void main()
{
int x = 1, y = 0, z = 5;
int a = x && y || z++;
printf("%d", z);
}
#include <stdio.h> void main() { int x = 1, y = 0, z = 5; int a = x && y || z++; printf("%d", z); }
#include <stdio.h>

void main()
{
    int x = 1, y = 0, z = 5;
    int a = x && y || z++;
    printf("%d", z);
}

A 0

B 5

C 6

D Other

mcq

Leave a Reply

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