• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

SP2 Contest 1

Question 1

Look at the below series and the options available:
m _ o p _ _ o p _ n _ p _ _ o p
Choose the correct option such that when letters from the option are sequentially placed between the gaps in the series, the series gets completed.
  • mnnmo
  • nmomn
  • nmonm
  • mnonm

Question 2

Predict the output of below C program:
C
#include<stdio.h>
int main()
{
    int a = 5, b = 10%9, i;
    for(i=1; i<10; i++)
    if(a != b);
        printf(\"a = %d b = %d\\n\", a, b);
        
    return 0;
}
  • 5 1
  • Prints “a = 5 b = 1” ten times.
  • a = 5 b = 1
  • The program will not produce any output

Question 3

Predict the output of the below C program: 

C
#include <stdio.h>

int main() 
{
    int i = 2, j = -2;
	
	if((printf(\"%d\", j)) < (printf(\"%d\", i)))
	   printf(\"%d\", i);
	else
	   printf(\"%d\", j);
    
    return 0;
}
  • 2-22

  • -22-2

  • 222

  • Compilation Error

Question 4

What will be the output of the below C program?
C
#include <stdio.h>

int main() 
{
    int a = 2;
	
	if(\"%d=gfg\", a);

    return 0;
}
  • Compilation Error
  • 2=gfg
  • No Output
  • 2

Question 5

What will be the output of the below C program? C
#include <stdio.h>

int main()
{
    int x = 2;

    do{
        ++x;
        
        printf(\"%d\", x);
    } while(--x <= 2);
    
    return 0;
}
  • Runtime Error
  • 2
  • 3
  • Infinite Loop

Question 6

What will be the output of below C++ program?
C
#include <iostream>

using namespace std;

int  main() 
{
    float _ = 20.5;
    
	int __ = 20;
	
	cout<< __ + _ <<endl;

    return 0;
}
  • Runtime Error
  • Compile Time Error
  • __+_
  • 40.5

Question 7

Predict the output of the below C program:
C
#include <stdio.h>

int main()
{
    int a = - -3;
    
    printf(\"a=%d\", a);

    return 0;
}
  • a=3
  • a=-3
  • a=2
  • None of the above

Question 8

Predict the output of the below C program:
C
#include <stdio.h>

int main() 
{
	int a = 5, b, c = 15, d = 13;
	
	b = (a = c, c += a, d = a + c + d);
	
	printf(\"%d %d %d %d\", a,c,b,d);
	
    return 0;
}
  • 5 30 0 58
  • 15 30 58 58
  • 15 30 0 58
  • 5 30 58 33

Question 9

Which of the following statement(s) is/are true about Associativity and Precedence of operators in C.
  1. Associativity is only used when there are two or more operators of the same precedence.
  2. All operators with the same precedence have the same associativity.
  3. Precedence and associativity of postfix ++ and prefix ++ are same.
  4. Comma operator has the highest precedence among all operators.
  • Only 1
  • Only 3
  • Both 1 and 2
  • Both 2 and 3

Question 10

What will be the output of the below C program?
C
#include <stdio.h>
int main()
{
    if (sizeof(int) > -10)
        printf(\"YES\");
    else
        printf(\"NO\");
    return 0;
}
  • YES
  • NO
  • YESNO
  • Compilation Error

There are 50 questions to complete.

Last Updated :
Take a part in the ongoing discussion