Search Header Logo

Pre-CA4

Authored by Noob Code

Computers

University

Pre-CA4
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

7 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following is true ?

gets() can read a string with newline characters but a normal scanf() with %s can not.

gets() can read a string with spaces but a normal scanf() with %s can not.

gets() can always replace scanf() without any additional code.

None of the Them.

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

#include <stdio.h>

int main()

{

    int i = 3;

    printf("%d", (++i)++);

    return 0;

}

What is the output of the above program?

3

4

5

Compile-time error.

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Predict the output .

#include <stdio.h>

 

int main()

{

   float c = 5.0;

   printf ("Temperature in Fahrenheit is %.2f", (9/5)*c + 32);

   return 0;

}

Temperature in Fahrenheit is 41.00

Temperature in Fahrenheit is 37.00

Temperature in Fahrenheit is 0.00

Compiler Error.

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the below program?

#include <stdio.h>

int main()

{

    int i = 0;

    switch (i)

    {

        case '0': printf("Geeks");

                break;

        case '1': printf("Quiz");

                break;

        default: printf("GeeksQuiz");

    }

    return 0;

}

Geeks

Quiz

GeeksQuiz

Compile-time error.

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

#include <stdio.h>

#define a 10

int main()

{

  printf("%d ",a);

 

  #define a 50

 

  printf("%d ",a);

  return 0;

}

Output ?

Compiler Error

10 50

50 50

10 10

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Predict output of following program

#include <stdio.h>

int main()

{

    int i;

    int arr[5] = {1};

    for (i = 0; i < 5; i++)

        printf("%d ", arr[i]);

    return 0;

}

1 followed by four garbage values

1 0 0 0 0

1 1 1 1 1

0 0 0 0 0

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

# include <stdio.h>

 

int main()

{

   char str1[] = "GeeksQuiz";

   char str2[] = {'G', 'e', 'e', 'k', 's', 'Q', 'u', 'i', 'z'};

   int n1 = sizeof(str1)/sizeof(str1[0]);

   int n2 = sizeof(str2)/sizeof(str2[0]);

   printf("n1 = %d, n2 = %d", n1, n2);

   return 0;

}

What is the output of following program?

n1 = 10, n2 = 9

n1 = 10, n2 = 10

n1 = 9, n2 = 9

n1 = 9, n2 = 10

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?