C++ Test

Exam Type: MCQ Skill Test
Questions Type: Multiple Choice Questions
Total Questions: 40
Time Limit: 15 Minutes
Last Update April, 2025

Text Detail

linkedin C++test

What is printed from this code?

vector v(22);

bool b = (v[6]);

printf ("%d", !b);

 

  • 0

  • This code has an error.

  • FALSE

  • 1

linkedin C++ test answers

Why is using this line considered a bad practice?

using namespace std;

 

  • It causes the compiler to enforce the exclusive inclusion of header files belonging to the Standard Library, generating compilation errors when a different header file is included.

  • If the code uses a function defined in two different libraries with the same prototype but possibly with different implementations, there will be a compilation error due to ambiguity.

  • It automatically includes all header files in the standard library (cstdint, cstdlib, cstdio, iostream, etc.)

  • The compiled code is always bigger because of all of the imported symbols.

linkedin C++assessment answers

What is the smallest size a variable of the type child_t may occupy in memory?

typedef struct{

    unsigned int  age    : 4;

    unsigned char gender : 1;

    char                 : 0;

    unsigned int  size   : 2;

}child_t;

  • 2 bytes

  • 1 bit

  • 7 bits

  • 25 bytes

linkedin C++ assessment questions

Which of the following shows the contents of vectors v1 and v2 after running this code?

std::vector v1{1,2,3}, v2;

v2=v1;

v1.push_back(4);

v2.push_back(5);

 

  • v1: {1,2,3,4}v2: {1,2,3,5}

  • v1: {1,2,3,4,5}v2: {1,2,3,4,5}

  • v1: {1,2,3,4}v2: {5}

  • ERROR

linkedin C++ assessment test

Which of the following is a true statement about the difference between pointers and iterators?

  • Pointers are variables that hold memory addresses, whereas iterators are unsigned integers that refer to offsets in arrays.

  • Incrementing an iterator always means accessing the next element in the container (if any), no matter the container. Incrementing a pointer means pointing to the next element in memory, not always the next element.

  • While pointers are variables that hold memory addresses, iterators are generic functions used to traverse containers. These functions allow the programmer to implement read and write code as the container is traversed.

  • All iterators are implemented with pointers, so all iterators are pointers, but not all pointers are iterators.

linkedin C++ quiz answers

linkedin C++ questions

linkedin C++ programming quiz answers

C++ linkedin assessment

C++ linkedin quiz

© 2025 Skill Test Answer. All Rights Reserved