Keyword

Result: 265 questions

Similarity between a structure, union and enumeration,

Quiz

What is the output of the following program?

#include<stdio.h>

main()
{ 
   struct student
   { 
       int num = 10;
   }var;

   printf("%d", var.num);
}

 

Quiz

Point out the error in the following program.

#include<stdio.h>
int main()
{
    struct emp
    {
        char name[20];
        float sal;
    };
    struct emp e[10];
    int i;
    for(i=0; i<=9; i++)
        scanf("%s %f", e[i].name, &e[i].sal);
    return 0;
}
Quiz

What is the output of the program?

typedef struct data;
{
    int x;
    sdata *b;
}sdata;
Quiz

Point out the error in the program?

#include<stdio.h>

int main()
{
    struct emp
    {
        char name[20];
        float sal;
    };
    struct emp e[10];
    int i;
    for(i=0; i<=9; i++)
        scanf("%s %f", e[i].name, &e[i].sal);
    return 0;
}
Quiz

A structure can contain similar or dissimilar elements

Quiz

What will be the output of the program?

#include<stdio.h>

typedef struct error {int warning, err, exception;} ERROR;
int main()
{
    ERROR e;
    e.err=1;
    printf("%d\n", e.err);
    return 0;
}
Quiz

If a char is 1 byte wide, an integer is 2 bytes wide and a long integer is 4 bytes wide then will the following structure always occupy 7 bytes?

struct ex
{
    char ch;
    int i;
    long int a;
};
Quiz

What will be the output of the program in Turbo C (under DOS)?

#include<stdio.h>

int main()
{
    struct emp
    {
        char *n;
        int age;
    };
    struct emp e1 = {"Dravid", 23};
    struct emp e2 = e1;
    strupr(e2.n);
    printf("%s\n", e1.n);
    return 0;
}
Quiz

Point out the error in the program?

#include<stdio.h>

int main()
{
    struct a
    {
        float category:5;
        char scheme:4;
    };
    printf("size=%d", sizeof(struct a));
    return 0;
}
Quiz

Point out the error in the program?

#include<stdio.h>
#include<string.h>
void modify(struct emp*);
struct emp
{
    char name[20];
    int age;
};
int main()
{
    struct emp e = {"Sanjay", 35};
    modify(&e);
    printf("%s %d", e.name, e.age);
    return 0;
}
void modify(struct emp *p)
{
     p ->age=p->age+2;
}
Quiz

The '.' operator can be used access structure elements using a structure variable.

Quiz

A header file contains macros, structure declaration and function prototypes.

Quiz

What will be the output of the program ?

#include<stdio.h>

    struct course
    {
        int courseno;
        char coursename[25];
    };
int main()
{
    struct course c[] = { {102, "Java"}, 
                          {103, "PHP"}, 
                          {104, "DotNet"}     };

    printf("%d ", c[1].courseno);
    printf("%s\n", (*(c+2)).coursename);
    return 0;
}
Quiz

Point out the error in the program?

struct emp
{
    int ecode;
    struct emp *e;
};
Quiz

On declaring a structure 0 bytes are reserved in memory.

Quiz

Point out the error in the program?

struct emp
{
    int ecode;
    struct emp e;
};
Quiz

Point out the correct statement which correctly free the memory pointed to by 's' and 'p' in the following program?

#include<stdio.h>
#include<stdlib.h>

int main()
{
    struct ex
    {
        int i;
        float j;
        char *s
    };
    struct ex *p;
    p = (struct ex *)malloc(sizeof(struct ex));
    p->s = (char*)malloc(20);
    return 0;
}
Quiz

What does the following code print to the console?

function c(f) {
  return f();
}
function blub() {
  return "monsters";
}
c(blub);

Answer:

"monsters"

The c() function takes a callback function as a parameter. blub is passed to c() as an argument and is invoked within the body of c().

Functions are "first class" in JavaScript because they can be passed as parameters and stored in data structures.

View

What does the following code print to the console?

function Builder () {
  this.self = function () {
    return this;
  }
}
b = new Builder();
console.log(b.self() === b);

Answer:

true

For constructor functions, "this" refers to the object that's created by the constructor function.

View

© 2017 QuizBucket.org