Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

C PROGRAM QUESTIONS : PART 7


#include<iostream>
#include<string.h>
using namespace std;

int main()
{
    char one[]="one";
    char two[]="two";
    
    if(one==two){
        cout<<"Equal";
    }
    
    if(strcmp(one, two)==0){
        cout<<"Equal";
    }
    else
    {
        cout<<"NotEqual";
    }

    return 0;
}

Equal
 EqualEqual
 EqualNotEqual
NotEqual
SHOW ANSWER

What will be the output of the C program?
#include<stdio.h>
int main()
{
    int i = 5, j = 6, k = 7;
    if(i > j == k)
        printf("%d %d %d", i++, ++j, --k);
    else    
        printf("%d %d %d", i, j, k);
    return 0;
}

5 7 6
5 6 7
 6 6 6
5 7 7
SHOW ANSWER

What will be the output of the C program?
#include<stdio.h>
int main()
{
    int i = 2;
    if(i == (1, 2))
        printf("Hai");
    else
        printf("No Hai");
    return 0;
}

Compilation Error
Runtime Error
Hai
 No Hai
SHOW ANSWER

What will be the output of the C program?
#include<stdio.h>
int main(){
char str[8] = "2braces";
char str1[8] = "2braces";
   if(str == str1)
       printf("Strings are Equal");
   else
       printf("Not Equal");
return 0;
}

Compilation Error
Run time error
Strings are Equal
Not Equal
SHOW ANSWER

What will be the output of the C program?
#include<stdio.h>
int main(){
    int i = 5;
    if(i == 3, 4)
         printf("Hai");
    else
        printf("No Hai");
    return 0;
}

Hai
 No Hai
Compilation Error
None of the Above
SHOW ANSWER

What will be the output of the C program?
#include<stdio.h>
int main(){
    char *str = {"2braces"};
    char *str1 = {"2braces"};
    if(*str == *str1)
        printf("inside if block");
    else 
        printf("inside else block");
    return 0;
}

Runtime Error
Compilation Error
inside if block
 inside else block
SHOW ANSWER

What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
        int x = 2, y = 0;
        int z = (y++) ? y == 1 && x : 0;
        printf("%d\n", z);
        return 0;
    }

 0
1
 Undefined behaviour
Compile time error
SHOW ANSWER

What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
        int x = 1;
        int y =  x == 1 ? getchar(): 2;
        printf("%d\n", y);
    }

Compile time error
Whatever character getchar function returns
Ascii value of character getchar function returns
2
SHOW ANSWER

Which keyword can be used for coming out of recursion?

return
exit 
 Both (a) and (b)

break 

SHOW ANSWER

What is the output of this C code?
int main()
{
   int a = 0, i = 0, b;
   for (i = 0;i < 5; i++)
  {
     a++;
     continue;
   }
}

 5
SHOW ANSWER

What is the output of this C code?
  int main()
 {
 int a = 0, i = 0, b;
 for (i = 0;i < 5; i++)
{
a++;
 if (i == 3)
                break;
        }
    }

 2 
 3 
4
SHOW ANSWER

The keyword ‘break’ cannot be simply used within:

do-while 
 if-else 
for 
while
SHOW ANSWER

 Which keyword is used to come out of a loop only for that iteration?

break 
continue 
return 
 None of the mentioned
SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in