All MCQs

Programming MCQs with Answers

Programming Practice

Practice Programming MCQs covering C Programming, Object-Oriented Programming, C++, Java with verified answers and step-by-step explanations.

Distraction-free environment with keyboard shortcuts (1-4, Enter, Esc)

Programming / Programming

C Programming MCQs

50 Questions

Data types, operators, pointers and undefined behaviour.

0 / 102 answered0 correct0 incorrect

1What happens when this code runs?

Code snippet
char *p = "hi";
p[0] = 'H';

2What is the output of this C code?

Code snippet
int x = 5;
printf("%d", x++ + ++x);

3What is size_t?

4What is the value of EOF on most systems?

5In fopen, which mode opens a file for appending?

6#include "file.h" differs from #include <file.h> in that it:

7What is the output?

Code snippet
#define SQR(x) x*x
printf("%d", SQR(2+1));

8What does typedef do?

9In an enum without explicit values, the first enumerator has the value:

10Which operator accesses a struct member through a pointer p?

11Typically, what is sizeof for this union (4-byte int)?

Code snippet
union U {
 int i;
 char c;
};

12Typically, what is sizeof for this struct (4-byte int)?

Code snippet
struct S {
 char c;
 int i;
};

13What is the output?

Code snippet
char *p = "abc";
printf("%c", *(p + 1));

14In most expressions, an array name is converted to:

15What is the output?

Code snippet
int a = 10;
int *p = &a;
*p = 20;
printf("%d", a);

16Which declaration makes fp a pointer to a function taking an int and returning an int?

17A dangling pointer is one that:

18realloc(NULL, n) behaves like:

19A memory leak occurs when:

20How does calloc() differ from malloc()?

21What happens if free() is called twice on the same pointer?

22malloc() returns:

23In the declaration int *const p, what is constant?

24What does int **pp declare?

25A void * pointer:

26What is the value of this expression?

Code snippet
int a[5];
&a[4] - &a[1]

27What is the output?

Code snippet
int a[] = {1, 2, 3};
int *p = a;
p++;
printf("%d", *p);

28Dereferencing a NULL pointer results in:

29On a typical 64-bit system, sizeof(int *) is:

30What is the output?

Code snippet
int x = 5, *p = &x;
printf("%d", *p);

31What does the string literal pointer p refer to in this code?

Code snippet
char *p = "hi";

32What is the output?

Code snippet
char s[10] = "hi";
printf("%zu", strlen(s));

33Why was gets() removed from the C11 standard?

34C stores multi-dimensional arrays in:

35What is the output (assuming 4-byte int)?

Code snippet
int a[2][3];
printf("%zu", sizeof(a));

36Which function is safe for copying overlapping memory regions?

37Which function appends one string to another?

38strcmp("a", "b") returns:

39A C string is terminated by:

40What is the output?

Code snippet
char s[] = "abc";
printf("%zu", sizeof(s));

41What is the output?

Code snippet
printf("%zu", sizeof("hello"));

42What does strlen("hello") return?

43In C, a[i] is defined as equivalent to:

44What is the output?

Code snippet
int a[3] = {10, 20, 30};
printf("%d", *(a + 1));

45Accessing an array element outside its bounds causes:

46What is the output?

Code snippet
int a[] = {1, 2, 3};
printf("%zu", sizeof(a) / sizeof(a[0]));

47What is a[4] after this declaration?

Code snippet
int a[5] = {1, 2};

48A function declared static at file scope has:

49Which of these cannot be returned directly from a C function?

50What is the output?

Code snippet
int x = 10;
{
 int x = 20;
 printf("%d ", x);
}
printf("%d", x);
Previous TopicTopic 1 of 48 · More questions availableNext Topic

Comprehensive Question Hub

Subject-Wise MCQ Practice

Select any core Computer Science or programming subject below to access dedicated practice questions, answers, and topic-wise modules.

Practice Computer Science MCQs27 Core Subjects

Fundamental CS engineering subjects covering systems, theory, and data architecture.

Programming Language MCQs9 Languages

Practice coding output questions, language syntax, OOP paradigms, and standard libraries.

Targeted Exam Preparation

MCQs for Competitive Exams

Prepare with exam-specific question banks tailored to syllabi, previous years' question papers, and negative-marking criteria.

Teaching Exam

BPSC TRE 2.0 Computer Science

Practice BPSC TRE 2.0 Class 11-12 Computer Science previous-year questions with solutions.

Teaching Exam

BPSC TRE 3.0 Computer Science

Practice BPSC TRE 3.0 Class 11-12 Computer Science previous-year questions with solutions.

Teaching Exam

BPSC TRE 4.0 Computer Science

Practice BPSC TRE 4.0 Class 11-12 Computer Science previous-year questions with solutions.

Teaching Eligibility Test

Bihar STET Paper II Computer Science

Practice Bihar STET Paper II Class 11-12 Computer Science questions with solutions.

National Exam

GATE Computer Science (CSE)

High-yield engineering questions covering Algorithms, Theory of Computation, Compiler Design, Computer Organization, and Operating Systems.

Assistant Professor & JRF

UGC NET Computer Science

Comprehensive question sets aligned with NTA UGC NET Paper II syllabus, featuring theoretical foundations, discrete math, and systems.

Government Recruitment

SSC & State Technical Exams

Foundational and practical MCQs for technical assistants, programmers, and informatics officers in central and state departments.

Why Practice MCQs on CodeZov?

A modern, high-yield practice platform designed to build speed, accuracy, and deep conceptual clarity.

Instant Answers & In-Depth Explanations

Receive immediate validation with step-by-step technical explanations and code breakdown so you learn from mistakes on the spot.

Full-Screen Distraction-Free Exam Mode

Simulate authentic exam environments with dedicated Full-Screen mode, keyboard shortcuts (1-4, A-D, Enter), and a live question matrix.

Topic-Wise & Subject-Wise Syllabus

Explore modular practice sets across Data Structures, Algorithms, DBMS, Operating Systems, Computer Networks, and modern programming languages.

Previous Year Questions (PYQs)

Solve authentic previous year questions adapted from BPSC TRE Computer Science, GATE CSE, and UGC NET question papers.

Ready to Deepen Your Conceptual Knowledge?

MCQ practice is most effective when paired with structured conceptual tutorials, career roadmaps, and full-length timed mock tests. Check out CodeZov's free resources to boost your preparation.

Core Syllabus Coverage

  • Programming (C, C++, Java, Python, SQL)
  • Data Structures & Algorithms
  • Database Management Systems (DBMS)
  • Operating Systems & Architecture
  • Computer Networks & Cybersecurity

Frequently Asked Questions

Answers to common questions about practicing Computer Science MCQs on CodeZov.

What are MCQs?

Multiple-Choice Questions (MCQs) are objective assessment questions where learners select the correct option from multiple choices. In Computer Science, MCQs evaluate theoretical understanding, code snippet outputs, algorithm time complexities, and system architecture fundamentals.

Can I practice Computer Science MCQs online?

Yes, CodeZov offers 100% free online Computer Science MCQ practice with instant scoring, step-by-step explanations, code execution analysis, and Hindi translations without requiring mandatory registration or fees.

Are MCQs available topic-wise?

Yes, all questions on CodeZov are systematically organized by subject (such as DBMS, Operating Systems, Data Structures) and further categorized into specific topics (such as Trees, Normalization, CPU Scheduling, and TCP/IP) for focused preparation.

Do MCQs include answers and explanations?

Every MCQ on CodeZov features verified correct answers alongside in-depth conceptual explanations. Many questions also include bilingual Hindi explanations and line-by-line code breakdowns to ensure complete conceptual clarity.

Which subjects are available for MCQ practice?

CodeZov provides MCQs across over 40 technical subjects including C Programming, C++, Java, Python, Data Structures, Algorithms, DBMS, Operating Systems, Computer Networks, Theory of Computation, Compiler Design, Digital Logic Design, and Software Engineering.

Can I use MCQs to prepare for competitive exams?

Yes, our question bank is specifically curated for competitive examinations including BPSC TRE Computer Science (Class 11-12), GATE CSE, NTA UGC NET / JRF, ISRO, NIELIT, Kendriya Vidyalaya (KVS/NVS) PGT Computer Science, and university semester exams.