adplus-dvertising

Welcome to the C Programming Fundamentals MCQs Page

Dive deep into the fascinating world of C Programming Fundamentals with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of C Programming Fundamentals, a crucial aspect of C Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of C Programming Fundamentals, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through C Programming Fundamentals. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of C Programming Fundamentals. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

C Programming Fundamentals MCQs | Page 8 of 24

Q71.
What will be the output of the program?
#include<stdio.h>

int main()
{
    const c = -11;
    const int d = 34;
    printf("%d, %d\n", c, d);
    return 0;
}
Discuss
Answer: (b).-11, 34
Q72.
Point out the error in the program.
#include<stdio.h>
#define MAX 128

int main()
{
    char mybuf[] = "CompSci";
    char yourbuf[] = "Bits";
    char *const ptr = mybuf;
    *ptr = 'a';
    ptr = yourbuf;
    return 0;
}
Discuss
Answer: (b).Error: cannot convert ptr const value
Q73.
Point out the error in the program (in Turbo-C).
#include<stdio.h>
#define MAX 128

int main()
{
    const int max=128;
    char array[max];
    char string[MAX];
    array[0] = string[0] = 'A';
    printf("%c %c\n", array[0], string[0]);
    return 0;
}
Discuss
Answer: (a).Error: unknown max in declaration/Constant expression required
Q74.
Point out the error in the program.
#include<stdio.h>
#include<stdlib.h>

union employee
{
    char name[15];
    int age;
    float salary;
};
const union employee e1;

int main()
{
    strcpy(e1.name, "K");
    printf("%s", e1.name);    
    e1.age=85;
    printf("%d", e1.age);
    printf("%f", e1.salary);
    return 0;
}
Discuss
Answer: (b).Error: cannot modify const object
Q75.
Point out the error in the program.
#include<stdio.h>
const char *fun();

int main()
{
    char *ptr = fun();
    return 0;
}
const char *fun()
{
    return "Hello";
}
Discuss
Answer: (c).No error and No output
Q76.
Point out the error in the program.
#include<stdio.h>

int main()
{
    const int x;
    x=128;
    printf("%d\n", x);
    return 0;
}
Discuss
Answer: (b).Error: const variable have been initialised when declared.
Q77.
Point out the error in the program.
#include<stdio.h>

int main()
{
    const int k=7;
    int *const q=&k;
    printf("%d", *q);
    return 0;
}
Discuss
Answer: (d).No error
Q78.
Point out the error in the program.
#include<stdio.h>
#define MAX 128

int main()
{
    char mybuf[] = "CompSci";
    char yourbuf[] = "Bits";
    char const *ptr = mybuf;
    *ptr = 'a';
    ptr = yourbuf;
    return 0;
}
Discuss
Answer: (a).Error: cannot convert ptr const value
Q79.
Point out the error in the program.
#include<stdio.h>
const char *fun();

int main()
{
    *fun() = 'A';
    return 0;
}
const char *fun()
{
    return "Hello";
}
Discuss
Answer: (c).Error: fun() returns a pointer const character which cannot be modified
Discuss
Answer: (a).Systems Programing Language

Suggested Topics

Are you eager to expand your knowledge beyond C Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!