You are on page 1of 7

19/09/2023, 05:21 C Programming - Online Quiz

Menu Search tutorials, courses and ebooks...


Login

Home

Coding
HTML Ground
CSS Javascript SQL Python Java C C++ PHP Scala C#

Jobs
C Programming - Online Quiz
Whiteboard

Tools

Following quiz provides Multiple Choice Questions (MCQs) related to C


Programming Framework. You will have to read all the given answers and
click over the correct answer. If you are not sure about the answer then you
can check the answer using Show Answer button. You can use Next Quiz
button to check new set of questions in the quiz.

Show Answer

Q 1 - What is the output of the following code snippet?

#include<stdio.h>

main()
{
int x = 5;

if(x==5)
{
if(x==5) break;
https://www.tutorialspoint.com/cprogramming/cprogramming_online_quiz.htm 1/7
19/09/2023, 05:21 C Programming - Online Quiz

printf("Hello");
}
printf("Hi");
}

A - Compile error

B - Hi

C - HelloHi

D - Hello

Show Answer

Q 2 - What is the output of the following program?

#include<stdio.h>

main()
{
int i = 1;

while(i++<=5);
printf("%d ",i++);
}

A-4

B-6

C-26

D-24

Show Answer

Q 3 - A macro can execute faster than a function.

A - true

B - false

https://www.tutorialspoint.com/cprogramming/cprogramming_online_quiz.htm
Sh A 2/7
19/09/2023, 05:21 C Programming - Online Quiz
Show Answer

Q 4 - What is the output of the following program?

#include<stdio.h>

main()
{
char *p = NULL;

printf("%c", *p);
}

A - NULL

B-0

C - Compile error

D - Runtime error.

Show Answer

Q 5 - What is the built in library function to compare two strings?

A - string_cmp()

B - strcmp()

C - equals()

D - str_compare()

Show Answer

Q 6 - Choose the correct program that round off x value (a float


value) to an int value to return the output value 4,

A - float x = 3.6;

int y = (int)(x + 0.5);

printf ("Result = %d\n", y );

https://www.tutorialspoint.com/cprogramming/cprogramming_online_quiz.htm 3/7
19/09/2023, 05:21 C Programming - Online Quiz

B - float x = 3.6;

int y = int(x + 0.5);

printf ("Result = %d\n", y );

C - float x = 3.6;

int y = (int)x + 0.5

printf ("Result = %d\n", y );

D - float x = 3.6;

int y = (int)((int)x + 0.5)

printf ("Result = %d\n", y );

Show Answer

Q 7 - Which of the following operator can be used to access


value at address stored in a pointer variable?

A-*

B-#

C - &&

D-@

Show Answer

Q 8 - How many times the given below program will print


"India"?

#include<stdio.h>

int main ()
{
int x;
https://www.tutorialspoint.com/cprogramming/cprogramming_online_quiz.htm 4/7
19/09/2023, 05:21 C Programming - Online Quiz

for(x=-1; x<=20; x++)int i;


{
if(x < 10)
continue;
else
break;
printf("India");
}

A - Unlimited times

B - 21 times

C - 0 times

D - 20 times

Show Answer

Q 9 - In C, what is the correct hierarchy of arithmetic


operations?

A - */ + -

B - * +- /

C - / *+ -

D-+-/*

Show Answer

Q 10 - Which statement can print \n on the screen?

A - printf("\\n");

B - printf("n\");

C - printf("n");

D - printf('\n');

https://www.tutorialspoint.com/cprogramming/cprogramming_online_quiz.htm 5/7
19/09/2023, 05:21 C Programming - Online Quiz

New Quiz

Kickstart Your Career


Get certified by completing the course

Get Started

Print Page Previous Next

Advertisements

Tutorials Point is a leading Ed Tech


company striving to provide the best
learning material on technical and non-
technical subjects.

https://www.tutorialspoint.com/cprogramming/cprogramming_online_quiz.htm 6/7
19/09/2023, 05:21 C Programming - Online Quiz

About us Terms Our Products


Company Terms of use Free Library

Our Team Privacy Policy Articles

Careers Refund Policy Coding Ground

Jobs Cookies Policy Certifications

Become a Teacher FAQ's Courses

Affiliates eBooks

Contact Us Corporate Training

Contact Us
Tutorials Point India Private Limited,
Incor9 Building, Kavuri Hills, Madhapur,
Hyderabad, Telangana - 500081, INDIA

© Copyright 2023. All Rights Reserved.

https://www.tutorialspoint.com/cprogramming/cprogramming_online_quiz.htm 7/7

You might also like