-
What is the syntax to declare a variable in C/C++?
a) int x = 10;
b) variable x = 10;
c) let x = 10;
-
What is the output of the following C/C++ code snippet?
int x = 10;
printf("%d", x);
x = 20;
printf("%d", x);
a) 1020
b) 2010
c) 1020
-
Which loop in C/C++ is used to iterate over a range of values?
a) for
b) while
c) do...while
-
In C/C++, what is used to handle error conditions and exceptions?
a) try
b) catch
c) finally
-
What keyword is used in C/C++ to exit a loop prematurely?
a) break
b) stop
c) exit
-
Which C/C++ library is used for input and output operations?
a) stdio.h
b) iostream
c) conio.h
-
In which programming language is the C/C++ code primarily written?
a) C
b) Java
c) C++
-
What will be the output of the following C/C++ code?
int a[] = {1, 2, 3};
int b[3];
b[0] = a[0];
b[1] = a[1];
b[2] = a[2];
printf("%d %d %d", b[0], b[1], b[2]);
a) 1 2 3
b) 2 1 3
c) 3 1 2