Company: Euler Motors_1aug
Difficulty: medium
C++ Fundamentals Assessment Choose the best answer for each question. 1. What is the time complexity of the following nested loops? For i from 1 to n, repeatedly double j from 1 while j <= n. O(log n) O(n) O(n log n) O(n²) 2. What is the main advantage of using a linked list over an array? Constant-time access to elements Efficient insertion and deletion of elements Fixed size Elements stored in contiguous memory locations 3. A binary search is performed on a sorted array of 1,000 elements. What is the maximum number of element comparisons needed in the worst case? 9 10 100 500 4. Which operator is used for dynamic memory allocation in C++? new malloc alloc create 5. Which of the following is not a valid variable name in C++? my_variable MyVariable 2variable _variable 6. What will the following C++ snippet print? int x = 5; int *ptr = &x; cout << ptr; Address of x 5 Compilation error Runtime error