Quiz-1

Hello PrepSter,

If you find any errors in the quiz below kindly comment in the comment section and we will make it our priority to fix it.

Also if you have a better of the solution to the questions, please do comment them below and if we find it better than ours, we will post it in our website.

 

Question 1

Time: 00:00:00
Which of the following is not a pointer declaration?
a) char a[10];
b) char a[] = {‘1’, ‘2’, ‘3’, ‘4’};
c) char *str;
d) char a;

char a[10]:

char a[10]:

char a[]={'1', '2', '3', '4'};

char a[]={'1', '2', '3', '4'};

char *str

char *str

char a;

char a;

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 2

Time: 00:00:00
. Which of the following statement is false?

A variable defined once can be defined again with different scope

A variable defined once can be defined again with different scope

A single variable cannot be defined with two different types in the same scope

A single variable cannot be defined with two different types in the same scope

A variable must be declared and defined at the same time

A variable must be declared and defined at the same time

A variable refers to a location in memory

A variable refers to a location in memory

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 3

Time: 00:00:00
The name of the variable used in one function cannot be used in another function.

True

True

False

False

May be

May be

none of the mentioned

none of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 4

Time: 00:00:00
This set of C MCQs focuses on “Character Handling – 1”.

1. Which header declares several functions useful for testing and mapping characters?

assert.h

assert.h

stdio.h

stdio.h

ctype.h

ctype.h

errno.h

errno.h

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 5

Time: 00:00:00
Which code from the given option return pointer to last occurrence of c in ch or NULL if not present?

char *strchr(ch, c)

char *strchr(ch, c)

char *strrchr(ch, c)

char *strrchr(ch, c)

char *strncat(ch, c)

char *strncat(ch, c)

char *strcat(ch, c)

char *strcat(ch, c)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 6

Time: 00:00:00
This function checks whether the passed character is white-space.

ispunct()

ispunct()

isgraph()

isgraph()

isspace()

isspace()

isalpha()

isalpha()

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 7

Time: 00:00:00
There are two groups of string functions defined in the header <string.h>. What are they?

first group names beginning with str; second group names beginning with mem

first group names beginning with str; second group names beginning with mem

first group names beginning with str; second group names beginning with is

first group names beginning with str; second group names beginning with is

first group names beginning with string; second group names beginning with mem

first group names beginning with string; second group names beginning with mem

first group names beginning with str; second group names beginning with type

first group names beginning with str; second group names beginning with type

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 8

Time: 00:00:00
A variable declared in a function can be used in main().

True

True

False

False

True if it is declared static

True if it is declared static

none of the mentioned

none of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 9

Time: 00:00:00
What is the use of function char *strchr(ch, c)?

return pointer to first occurrence of ch in c or NULL if not present

return pointer to first occurrence of ch in c or NULL if not present

return pointer to first occurrence of c in ch or NULL if not present

return pointer to first occurrence of c in ch or NULL if not present

return pointer to first occurrence of ch in c or ignores if not present

return pointer to first occurrence of ch in c or ignores if not present

return pointer to first occurrence of cin ch or ignores if not present

return pointer to first occurrence of cin ch or ignores if not present

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 10

Time: 00:00:00
Which among the given options compares atmost n characters of string ch to string s?

int strncmp(ch, s, n)

int strncmp(ch, s, n)

int strcmp(ch, s)

int strcmp(ch, s)

int strncmp(s, ch, n)

int strncmp(s, ch, n)

int strcmp(s, ch)

int strcmp(s, ch)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 11

Time: 00:00:00
What does the following C code do?

int iscntrl( int c);

tests for only space character

tests for only space character

tests for only digit

tests for only digit

tests for any control character

tests for any control character

no function as such

no function as such

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 12

Time: 00:00:00
Which among the given options compares atmost n characters of string ch to string s?

int strncmp(ch, s, n)

int strncmp(ch, s, n)

int strcmp(ch, s)

int strcmp(ch, s)

int strncmp(s, ch, n)

int strncmp(s, ch, n)

nt strcmp(s, ch)

nt strcmp(s, ch)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 13

Time: 00:00:00
Which among the given options is the right explanation for the statement size_t strcspn(c, s)?

return length of prefix of s consisting of characters not in c

return length of prefix of s consisting of characters not in c

return length of prefix of s consisting of characters present in c

return length of prefix of s consisting of characters present in c

return length of prefix of c consisting of characters not in s

return length of prefix of c consisting of characters not in s

return length of prefix of c consisting of characters present in s

return length of prefix of c consisting of characters present in s

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 14

Time: 00:00:00
The mem functions are meant for _______

returning a pointer to the token

returning a pointer to the token

manipulating objects as character arrays

manipulating objects as character arrays

returning a pointer for implemented-defined string

returning a pointer for implemented-defined string

returning a pointer to first occurrence of string in another string

returning a pointer to first occurrence of string in another string

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 15

Time: 00:00:00
Functions whose names begin with “strn”

manipulates sequences of arbitrary characters

manipulates sequences of arbitrary characters

manipulates null-terminated sequences of characters

manipulates null-terminated sequences of characters

manipulates sequence of non – null characters.

manipulates sequence of non – null characters.

returns a pointer to the token

returns a pointer to the token

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

One comment on “Quiz-1”