Company: Applogic networks_Software engineer intern_Oncampus_21july
Difficulty: medium
This set contains ten independent multiple-choice questions from the assessment, spanning C++, Python, data structures, computer networks, operating systems, cloud infrastructure and aptitude. Each question is self-contained: read the stem, study any code shown, and pick the single best option. Q1. What is the error in the following C++ code? #include <iostream> using namespace std; int main() { int arr[3] = {1, 2, 3}; for (int i = 0; i <= 3; i++) { cout << arr[i] << " "; } return 0; } The 'cout' statement inside the loop should be replaced with 'printf' for better performance in C++ The for loop must be replaced with a while loop to work correctly with arrays in C++ Arrays in C++ are zero-indexed, so the loop should start from '1' instead of '0' The for loop condition should use '<' instead of '<=' to avoid accessing out of bounds Q2. Which one of the given options is used to set the position in the output sequence? iostream :: tellg() iostream :: seekp() io