adplus-dvertising

Welcome to the Pointers,Arrays and Structures in C++ MCQs Page

Dive deep into the fascinating world of Pointers,Arrays and Structures in C++ with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Pointers,Arrays and Structures in C++, a crucial aspect of Object Oriented Programming Using C++. In this section, you will encounter a diverse range of MCQs that cover various aspects of Pointers,Arrays and Structures in C++, 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 Object Oriented Programming Using C++.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Pointers,Arrays and Structures in C++. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Object Oriented Programming Using C++.

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

Pointers,Arrays and Structures in C++ MCQs | Page 7 of 17

Q61.
What is the output of this program?
    #include <iostream>
    using namespace std;
    struct Time 
    {
        int hours;
        int minutes;
        int seconds;
    };
    int toSeconds(Time now);
    int main()
    {
        Time t;
        t.hours = 5;
        t.minutes = 30;
        t.seconds = 45;
        cout << "Total seconds: " << toSeconds(t) << endl;
        return 0;
    }
    int toSeconds(Time now)
    {
        return 3600 * now.hours + 60 * now.minutes + now.seconds;
    }
Discuss
Answer: (a).19845
Q62.
What will be the output of this program?
    #include <iostream>
    using namespace std;
    int main()
    {
        struct ShoeType 
        {
           string style;
           double price;
        };
         ShoeType shoe1, shoe2;
         shoe1.style = "Adidas";
         shoe1.price = 9.99;
         cout << shoe1.style << " $ "<< shoe1.price;
         shoe2 = shoe1;
         shoe2.price = shoe2.price / 9;
         cout << shoe2.style << " $ "<< shoe2.price;
         return 0;
    }
Discuss
Answer: (a).Adidas $ 9.99Adidas $ 1.11
Q63.
What is the output of this program?
    #include <iostream>
    using namespace std;
    struct sec 
    {
        int a;
        char b;
    };
    int main()
    {
        struct sec s ={25,50};
        struct sec *ps =(struct sec *)&s;
        cout << ps->a << ps->b;
        return 0;
    }
Discuss
Answer: (a).252
Q64.
Which of the following is a properly defined structure?
Discuss
Answer: (d).struct a_struct {int a;};
Q65.
Which of the following accesses a variable in structure *b?
Discuss
Answer: (a).b->var;
Q66.
The keyword used to define a structure is _____
Discuss
Answer: (c).struct
Q67.
When accessing a structure member, the identifier to the left of the dot operator is the name of
Discuss
Answer: (c).a structure variable
Q68.
Using new may result in less _____ memory than using an array
Discuss
Answer: (a).wasted
Discuss
Answer: (a).reference variables are easier to use
Q70.
The C++ expression p --> val means the same thing as
Discuss
Answer: (c).(*p).vai

Suggested Topics

Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? 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!