Code Quiz

A vibrant and engaging illustration depicting a computer screen with code and a person pondering over a question, symbolizing a coding quiz atmosphere.

Code Mastery Quiz

Test your programming skills and knowledge with our engaging Code Mastery Quiz! This quiz is designed to challenge you with thought-provoking questions covering various programming concepts, code outputs, and best practices.

  • 12 challenging questions
  • Multiple choice answers
  • Perfect for developers and coding enthusiasts
12 Questions3 MinutesCreated by CodingNinja137
What is the output of the following program?

#include
<stdio.h> main() { int a[3] = {2,1}; printf("%d", a[a[1]]); }

A - 0

B - 1

C - 2

D - Syntax Error

 
What is the output of the following program?
#include<stdio.h>

main()
{
   int I = 1;
   
   while(i++<=5);
       printf("%d ",i++);
}

A - 4

B - 6

C - 2 6

D - 2 4

 
Does both the loops in the following programs prints the correct string length?
 
#include<stdio.h>

main()
{
   int i;
   char s[] = "hello";

   for(i=0; s[i]; ++i);
      printf("%d ", i);

   i=0; 
   while(s[i++]);
      printf("%d ", i);
}

A - Yes, both the loops prints the correct length

B - Only for loop prints the correct length

C - Only while loop prints the correct length

D - Compile error in the program.

 
 
Predict the output of the following code segment:

// Add stdio.h header file in below code int main() { int number1 = -17; int number2 = -5; int result = number1 % number2; printf("%d",result); return 0; }

A - 2

B - -2

C - 3,4

D - -3,4

Predict the output of the following code segment:


// Add stdio.h header file in below code int main() { unsigned int a = -1; int b = ~0; int result; if (b == a) printf("equal"); else printf("unequal"); return 0; }

A - Equal

B - Unequal

C - 0

D - Compile Error
Examine the following code. How many times will the nested loop run?
 
for (int I = 1; i<=3; i++) {
for (int j  = 1; j <= I; j++) {
}
 
A - 3
 
B - 6
 
C - 1
 
D - 9
What is the time, space complexity of following code:
 
int a = 0, b = 0;
for (i = 0; I < N; i++) {
    a = a + rand();
}
for (j = 0; j < M; j++) {
    b = b + rand();
}
 
A - O(N * M) time, O(1) space
 
B - O(N + M) time, O(N + M) space
 
C - O(N + M) time, O(1) space
 
D -  O(N * M) time, O(N + M) space
What is the time complexity of following code:
 
int a = 0, I = N;
while (i > 0) {
    a += I;
    i /= 2;
}
A - O(N)
B - O(Sqrt(N))
C - O(N / 2)
D - O(log N)
Which of these best describes an array?
 
A. A data structure that shows a hierarchical behavior
B. Container of objects of mixed types
C. Container of objects of similar types
D. All of the mentioned
What is the output of the following piece of code?
 
public class array
  {
    public static void main(String args[])
    {
     int []arr = {1,2,3,4,5};
     System.out.println(arr[5]);
    }
}

A. 4
B. 5
C. ArrayIndexOutOfBoundsException
D. InavlidInputException
Which of the following don’t use matrices?
 
A - In solving linear equations
B -  Image processing
C -  Graph theory
D - Sorting numbers
What is the order of a matrix?
 
A - number of rows multiplied number of columns
B - number of columns multiplied number of rows
C - number of rows multiplied number of rows
D - number of columns multiplied number of columns
{"name":"Code Quiz", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your programming skills and knowledge with our engaging Code Mastery Quiz! This quiz is designed to challenge you with thought-provoking questions covering various programming concepts, code outputs, and best practices.12 challenging questionsMultiple choice answersPerfect for developers and coding enthusiasts","img":"https:/images/course1.png"}
Powered by: Quiz Maker